BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
radha009
Quartz | Level 8

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

1 ACCEPTED SOLUTION

Accepted Solutions
SuryaKiran
Meteorite | Level 14

Use update statement:

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

View solution in original post

4 REPLIES 4
SuryaKiran
Meteorite | Level 14

Use update statement:

DATA WANT;
UPDATE HAVE(obs=0) Have;
by Name;
run;
Thanks,
Suryakiran
radha009
Quartz | Level 8

i got 0 observations.

 

novinosrin
Tourmaline | Level 20

@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?

radha009
Quartz | Level 8

Thank you all.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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