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?
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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: