BookmarkSubscribeRSS Feed
spasico
Calcite | Level 5

I'm new to SAS. I'm doing research for stock market, and I want to run a regression with fixed effect by industry and year at the same time(i.e: if there are four industry and ten years, I want to generate forty regression results for each industry in each year)

I run the code as following, which the result isn't what I want obviously.

 

/////

proc glm data=dac;
class industry year;
model y = x1 x2 x3 industry year / solution;
run;
quit;

/////

 

Is there any way to solve my problem?

2 REPLIES 2
PaigeMiller
Diamond | Level 26

I run the code as following, which the result isn't what I want obviously.

 

Since Industry and Year are class variables, you do get different intercepts for each industry/year combination, but the slopes of X1 X2 and X3 are constant. If you want different slopes for each industry/year combination:

 

model y = x1*industry*year x2*industry*year x3*industry*year/ solution;

That's one way to get the slopes for each industry/year combination, there are other MODEL statements that do the equivalent but are parameterized differently.

--
Paige Miller
spasico
Calcite | Level 5
now I feel like I'm stupid....
This does help! thanks a lot to @PaigeMiller

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 835 views
  • 0 likes
  • 2 in conversation