SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Creating monthly variables using several dates

Reply
Contributor
Posts: 37

Creating monthly variables using several dates

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  
Super User
Posts: 10,500

Re: Creating monthly variables using several dates

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. )?

Contributor
Posts: 37

Re: Creating monthly variables using several dates

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

Ask a Question
Discussion stats
  • 2 replies
  • 249 views
  • 0 likes
  • 2 in conversation