Hi guys,
I am working on a dataset with participants having multiple rows.
I want to know if any participant have used a specific medicare item number more than once in a same day. For example participant T10002 have used "36" twice in the same date (3rd and 4th rows).
Thanks mates
In SQL (there are other ways) this would be:
proc sql;
select participant_id, medicare_item_number, date_of_service, count(date_of_service)
from have
group by participant_id, medicare_item_number, date_of_service
having count(date_of_service) > 1;
quit;
Hope this helps,- Jan.
In SQL (there are other ways) this would be:
proc sql;
select participant_id, medicare_item_number, date_of_service, count(date_of_service)
from have
group by participant_id, medicare_item_number, date_of_service
having count(date_of_service) > 1;
quit;
Hope this helps,- Jan.
Thanks
How about
data test;
input subject$ med item$ date$;
datalines;
T10002 23 A1 8/3/2009
T10002 23 A1 10/26/2009
T10002 36 A1 12/9/2009
T10002 36 A1 12/9/2009
T10002 110 A4 12/16/2009
T10002 116 A4 1/12/2009
;
run;
proc sort data=test out=test_1;
by subject item date;
run;
proc freq data=test_1 noprint;
tables med / out=cnt;
by subject item date;
run;
Do you want a data set, something that goes into other procedures for analysis, or a report for humans? Do want to see the counts of everything or only the cases where there are two or more of the item on the same date?
And are your "dates" actually SAS date values or just character variables that look like dates?
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.
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.