Good evening everyone. I have a result table I created after some joins and analysis. My table has provider number, treatment code, facility name. For the most records, each provider number has one facility name attributed to it, but in few cases there are multiple facility names for unique combination of provider number and treatment code. I want to identify those and just keep the first occurring facility name and remove the second record.
Have:
prov_num tc_code fac_nm
01 a abc
01 a abc_1
01 b abc_1
03 c def
03 c def_1
Want:
prov_num tc_code fac_nm
01 a abc
01 b abc_1
03 c def
Thanks in advance!
Something like this?
proc sort data=sashelp.class nodupkey out=want dupout=dont_want;
by sex age;
run;
Potentially you might want to sort it first on prov_num, tc_code and fac_nm. Then another sort with no dupkey on prov_num and tc_code like in the above example.
Something like this?
proc sort data=sashelp.class nodupkey out=want dupout=dont_want;
by sex age;
run;
Potentially you might want to sort it first on prov_num, tc_code and fac_nm. Then another sort with no dupkey on prov_num and tc_code like in the above example.
If your have set is grouped/ sorted as implied then perhaps:
data want; set have; by notsorted prov_num notsorted tc_code; if first.tc_code; run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.