Hi all,
I am trying to create dummies around different event years for different firms in the sample. For instance, the sample looks like this:
Cusip Year Event
1 1990 0
1 1991 0
1 1992 1
1 1993 1
1 1994 0
1 1995 0
2 1999 0
2 2000 0
2 2001 1
2 2002 0
2 2003 0
2 2004 0
Event (=1) reflects the year in which it took place. So, I want to create different dummies (before one year, before two years, event year, after one year and after two years of the event) revolving around the event for the respective firms. In total, five different dummies -2, -1, 0, +1, +2 for each firm. Can you please help me with the codes?
Regards,
Amanjot
Many analyses in SAS can be performed using SAS procedures that internally create dummy variables, so you don't have to create them yourself.
What analysis do you plan to do with this data?
Hi,
thanks for your response,
Basically, I want to put these dummies into a regression model to capture their impact on our 'variable of interest'. Can you please help with the SAS procedures?!
Regards,
Amanjot
Use PROC GLM or PROC LOGISTIC to do a regression with a categorical variable(s), which can be identified as categorical using a CLASS statement . Then you don't have to create the dummies yourself. For example:
proc logistic data=have;
class cusip year;
model event = cusip year;
run;
In your sample, CUSIP 1 has 2 event years. Do you want to generate two series? If so, would they be 2 columns? Or would they generate additional rows to accommodate the time-span surrounding each event?
Hello,
thanks for your response,
In the analysis, it is OK to have several nearby events. In that case, before1 (say) will have two values for the respective events.
Regards,
Amanjot
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.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.