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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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