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

Hi,

 

data abc;
input name$ status sal;
datalines;
hhh 0 4500
hhh 1 5600
ddd 0 7688
uhd 1 7544
yhd 0 6666
;
run;

 

i have 3 variables name , status and sal.

i want to pick status 0 when the names are same(as 0 is original status and 1 is duplicated).

 

ex: we have two observation above with same name 

hhh 0
hhh 1

 

so i want to pick the values with 0 status.

 

thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
japelin
Rhodochrosite | Level 12

If you only have either 0 or 1 Status per person, how about the following code to do it?

 

proc sort data=abc out=sorted;
  by name status;
run;

data want;
  set sorted;
  by name status;
  if first.name;
run;

View solution in original post

1 REPLY 1
japelin
Rhodochrosite | Level 12

If you only have either 0 or 1 Status per person, how about the following code to do it?

 

proc sort data=abc out=sorted;
  by name status;
run;

data want;
  set sorted;
  by name status;
  if first.name;
run;

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 646 views
  • 0 likes
  • 2 in conversation