Hi folks,
I have a data set as follows;
ID Eventdate practice status
1 01/03/2016 SMP Intervention
1 03/09/2016 SMP Intervention
1 04/12/2016 SMP Intervention
1 01/03/2017 SMP Intervention
1 09/06/2017 SMP Intervention
1 12/09/2017 SMP Intervention
1 01/12/2017 SMP Intervention
1 01/05/2018 SMP Intervention
2 01/03/2016 BMP Control
2 03/09/2016 BMP Control
2 04/12/2016 BMP Control
2 01/03/2017 BMP Control
2 09/06/2017 BMP Control
2 12/09/2017 BMP Control
Where each EventDate represent a visit to health center.
I want to create a data set to perform difference-in-difference analysis using proc mixed for which I need total number of visits for each id by following three time periods;
if EventDate<'01SEP2017'd then month4='-1';*pre-intervention;
else if '01SEP2017'd <=EventDate<= '28FEB2018'd then month4='0';*intervention;
else if EventDate >= '01MAR2018'd then month4='1';*post-intervention;
basically creating wide data set as follows;
ID Eventdate practice status Total_visits_preintervention Total_visits-Intervention Total_Visits_postintervention
Can someone help how do I do that please?
Thanks
S
Thanks Reza,
It worked perfectly fine! can I ask you another related question?
Where do I add other variables like age, sex etc. in this syntax to keep them in the data set as I will be using them in the adjusted models?
Appreciate your help!
Thanks Reza.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.