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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.