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.
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;
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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.