BookmarkSubscribeRSS Feed
Mystik
Obsidian | Level 7

Hello.

I have a SAS file called Prg_grp. One of the variables in this file is called "outcomes" coded as 0,1,2 or 3. 

1 in the outcome denotes = asthin

2 =  Coap

3 = Soca

However any of my outcome that is not either of the above is denoted = 0.

I have 11, 829,526 of observations but my total number based on ID without duplications is 85,000.

 

My file has other variables such as ID, medic, medic_date.

I want to remove duplicates so that only an ID has either 1, 2, or 3 and the total number of rows corresponding to my ID is exactly 85,000.

 

2 REPLIES 2
SuryaKiran
Meteorite | Level 14

Hi,

 

Why not an IF condition to only keep the records you need.

 

data want;
set have;
if outcomes in (1,2,3);
run;
Thanks,
Suryakiran
Mystik
Obsidian | Level 7

Thank you.

however, i will still get duplicates because, those codes in medic variable which are not 1, 2, 3 will still be available in medic variable. So those observations will still be present in medic.

Running a proc freq on outcome variable will yield those values not coded 1,2 or 3 as missing.

Also the outcome variables of 1, 2 or 3 are based on a single code in medic or combination of codes.

SAS Innovate 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 2 replies
  • 725 views
  • 0 likes
  • 2 in conversation