DATA Step, Macro, Functions and more

duplicate date into single record

Accepted Solution Solved
Reply
Contributor
Posts: 67
Accepted Solution

duplicate date into single record

please help me how to display one record per name as data below

 

name    chg1     chg2            chg3              ID

 

abc         12                                                 12

abc                         12                                  12

abc                         12                                   12

 xyz          33                                33               33

 xyz                                               33               33

expecting:

 

name    chg1         chg2            chg3              ID

 

abc         12             12                                    12

xyz          33                                    33             33

 

Thank you


Accepted Solutions
Solution
‎04-17-2018 01:03 PM
Valued Guide
Posts: 558

Re: duplicate date into single record

Use update statement:

DATA WANT;
UPDATE HAVE(obs=0) Have;
by Name;
run;
Thanks,
Suryakiran

View solution in original post


All Replies
Solution
‎04-17-2018 01:03 PM
Valued Guide
Posts: 558

Re: duplicate date into single record

Use update statement:

DATA WANT;
UPDATE HAVE(obs=0) Have;
by Name;
run;
Thanks,
Suryakiran
Contributor
Posts: 67

Re: duplicate date into single record

Posted in reply to SuryaKiran

i got 0 observations.

 

PROC Star
Posts: 1,564

Re: duplicate date into single record

@radha009 , The code given by @SuryaKiran is correct. Post your log please

 

data have;
input name  $  chg1     chg2            chg3              ID;
datalines;
abc         12              .   .                           12
abc            .             12                .                  12
abc            .             12                 .                  12
 xyz          33              .                  33               33
 xyz            .             .                      33               33
 ;

DATA WANT;
UPDATE HAVE(obs=0) Have;
by Name;
run;


99   DATA WANT;
100  UPDATE HAVE(obs=0) Have;
101  by Name;
102  run;

NOTE: There were 0 observations read from the data set WORK.HAVE.
NOTE: There were 5 observations read from the data set WORK.HAVE.
NOTE: The data set WORK.WANT has 2 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds

BTW did you sort your dataset?

Contributor
Posts: 67

Re: duplicate date into single record

Posted in reply to novinosrin

Thank you all.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 113 views
  • 2 likes
  • 3 in conversation