I have data on about 10,000 records, all have ID and several dates for which I need to create monthly variables whether or not the patient receive treatment anytime from 01/01/2011-12/31/2014.
the data follows this table. I have Teat1-Treat15, Admission_date1 to Admission_date15, Release_Date1 to Release_Date15
and Release_Desc1 to Release_Desc15
So I need to create here for the first record monthly variables Jan11....March13 for which Treatement is Yes. This patient died on 1/17/2014 so Jan14 will be death
The second patient here was not reated on the first admission which lasted from 7/29/2011 to 8/14/2011-patient was moved then. Then on 8/14/2014 was admitted again, received treament and released on 12/11/2014
CHIA_Random_ID | Treat1 | Treat2 | Admission_date1 | Admission_date2 | Release_date1 | Release_date2 | Release_date3 | RELEASE1 | RELEASE2 |
1VM | Y | 3/15/2013 | 1/17/2014 | Death | |||||
2VB | Y | 7/29/2011 | 9/14/2014 | 8/14/2011 | 12/11/2014 | Moved | Released | ||
3MP | 12/30/2013 | 1/14/2014 | Released |
Please provide an example of the outcome for the given example data. I'm not quite sure what you are trying to accomplish and an example would help.
Also, are your date values actual SAS date valued variables (they have a format assigned to the variables like MMDDYY10. )?
CHIA_Random_ID |
Treat1 |
Treat2 |
Admission_date1 |
Admission_date2 |
Release_date1 |
Release_date2 |
Release_date3 |
RELEASE1 |
RELEASE2 |
2VB |
Y |
7/29/2011 |
9/14/2014 |
8/14/2011 |
12/11/2014 |
Moved |
Released |
DOC1 to DOC48 (01/01/2011-12/31/2014) In hospital in any portion of month in question
TC1 to TC48 (01/01/2011-12/31/2014) Receiving treatment while admitted in any portion of month in question
For the second record here:
DOC7 will be 1, and DOC45 is 1 and the rest are all 0 (DOC1-DOC6, DOC8-DOC44, DOC46-DOC48)
TC45-TC48 will be 1 and all the rest are all 0
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.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.