BookmarkSubscribeRSS Feed
applemonster
Fluorite | Level 6

I want to add interaction terms in SAS Proc Panel. I checked some online materials and heard that I need to use the Class Statment.

So here below is my code:

proc panel data=rrd_come.city_ln_combo_8;
id City TimeID;
class event_level1 event_level2;
model LoanNum = StructureBreak event_level1 event_level2 GDP_per_capita HHI event_level1*GDP_per_capita event_level2*GDP_per_capita
event_level1*HHI event_level2*HHI/ fixone printfixed;
run;

And the result looks like below:

applemonster_0-1600308775350.png

It makes sense, but it looks ugly. I want to ask whether it is the optimal strategy to include interaction terms. Do we have to treat dummy variables as categorical variables? I mean SAS may treat the values of a categorical variable as text, which may explain the way it output the results. But a dummy variable has two numerical values, 0 and 1, so I think it is a waste to use a categorical-variable format to represent a dummy variable. Is there a better way to write the code? Thanks for your valuable suggestions!

 

1 REPLY 1
SteveDenham
Jade | Level 19

What happens when you remove the CLASS statement but leave in interactions with the dummy variables?  I am going to guess that the solution vector values are identical to what you have.  The advantage of the CLASS statement over dummy variables in a regression is that interactions (especially three way and higher, or for variables with multiple levels) are much easier to introduce.  In fact, there is an entire procedure devoted to creating dummy variables for models with CLASS variables of this sort (GLMMOD).  Plug in the design variables in the CLASS statement, and get out all of the dummies corresponding to those.

 

SteveDenham

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!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 728 views
  • 0 likes
  • 2 in conversation