Hi,
I am really stuck on this and I have figured this out manually before via pivots and whatnot but I'm blanking out on this now.
What is the way to do this in SAS? Here is an example of my data:
ID Procedure Code Date of Service
567 93880 1/1/2020
567 93306 1/1/2020
567 93880 3/1/2020
567 93306 3/1/2020
689 93880 2/1/2020
689 93306 2/1/2020
I would only want to bring in those where the ID uses BOTH codes and happened on the same day so that I can then total the dollars associated with those people.
Please help if you have any ideas. Thank you
Please post what you expect as result from the data you have posted.
And some more questions:
- is date_of_service a sas-date?
- how many different values are stored in procedure_code? just two?
Try this in PROC SQL.
create table want as
select * from have
group by ID, date_of_service
having max(case when (procedure='93880') then 1 else 0) = 1
and max(case when (procedure='93306') then 1 else 0) = 1
;
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 25. 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.