Folks,
I'm new to regression analysis in SAS. Before I would have done all my economteric modelling using Stata.
I would like to run an OLS regression model where my independent variables are both continous and categorical.
My model is;
depen = age agesq sex pes region
where age and agesq are continous variables and region pes and sex are catergorical
I provide a sample of my data for ease of interpreation.
Any help is most welcome on how to run a model with two different types of variables
region | age | PES | Sex | Depen | agesq |
7 | 60 | 1 | 1 | -0.00811 | 120 |
7 | 27 | 3 | 2 | -0.00205 | 54 |
5 | 58 | 3 | 1 | -0.00786 | 116 |
7 | 48 | 3 | 1 | 0.022108 | 96 |
7 | 43 | 3 | 2 | 0.089243 | 86 |
1 | 39 | 3 | 2 | . | 78 |
1 | 23 | 3 | 2 | 0.161818 | 46 |
1 | 17 | 1 | 1 | 0.170991 | 34 |
7 | 55 | 1 | 1 | 0.002723 | 110 |
1 | 61 | 2 | 1 | 0.00234 | 122 |
7 | 41 | 2 | 1 | -0.00218 | 82 |
2 | 45 | 2 | 1 | 0.020718 | 90 |
3 | 40 | 2 | 1 | 0.032785 | 80 |
3 | 30 | 2 | 1 | . | 60 |
7 | 31 | 1 | 2 | -0.00826 | 62 |
4 | 48 | 1 | 2 | 0.089272 | 96 |
4 | 21 | 2 | 1 | 0.097149 | 42 |
3 | 48 | 1 | 1 | -0.02082 | 96 |
3 | 22 | 1 | 2 | -0.01019 | 44 |
3 | 18 | 2 | 2 | 0.018829 | 36 |
4 | 36 | 2 | 2 | 0.022785 | 72 |
2 | 39 | 2 | 1 | 0.010147 | 78 |
4 | 36 | 1 | 1 | -0.0733 | 72 |
2 | 33 | 1 | 2 | -0.00031 | 66 |
4 | 33 | 1 | 2 | -0.00069 | 66 |
This will be helpful Introduction to Regression Procedures
Either proc reg or proc glm will do but dummy variables of your categorical variables are to be used in proc reg unlike proc glm where you just specify your categorical variables in the class statement.
And proc reg has more regression model diagnostics features.
@Miracle already provided your two choices and the differences between them. However, you will first want to correct your agesq variable as it is currently 2*age rather than age**2
Art, CEO, AnalystFinder.com
Hi,
Also, why are you including 2*age as a predeictor in the model. This will introduce multicollinearity in the model resutling non unique solutions.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.