BookmarkSubscribeRSS Feed
amanjot_42
Fluorite | Level 6

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 

5 REPLIES 5
PaigeMiller
Diamond | Level 26

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?

--
Paige Miller
amanjot_42
Fluorite | Level 6

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

PaigeMiller
Diamond | Level 26

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;
--
Paige Miller
mkeintz
PROC Star

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?

 

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
amanjot_42
Fluorite | Level 6

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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 5 replies
  • 595 views
  • 0 likes
  • 3 in conversation