BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mitrakos
Obsidian | Level 7

Hi Everyone,

 

I'm running a linear regression and currently trying to figure out how to properly structure my data set. change_in_value is the dependent variable. All variables before are independent variables. weight and bmi are the only continuous IV's, while the rest are discrete. My goal is to run a regression using each IV in a separate regression model for now.

 

data have;
	input gender race education employment marriage income weight bmi change_in_value;
datalines;
0 1 1 1 0 1 120 25.4 -10
0 1 2 1 0 1 110 23 -5
0 1 2 1 0 1 115 23.5 -7
0 1 3 1 0 1 140 25 5
1 2 3 1 0 2 185 28 -12.5
1 2 2 0 0 2 160 26.5 -14
1 2 2 0 0 2 150 26 -10
1 3 1 0 1 2 140 25.5 5
1 3 4 0 1 3 165 26.5 7
0 4 4 0 1 3 185 27.5 9 
0 4 5 1 1 4 195 29 12
0 5 5 1 0 4 205 29.5 -15
;
run;

Gender and employment are simple binary 0/1 variables, which is simple for this process. My main concern is variables such as race that have many levels (5).  I understand that a linear regression requires dummy variables to be made, however I am unclear how to do that in SAS, and how to structure dummy variables in general. 

 

If anyone could help me that would be wonderful, thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Technically, if your model is a categorical variable as the independent variable, it's not really regression any more, it's Analysis of Variance, but the idea/concept is the same as regression.

 

proc glm data=have;
    class race;
    model change_in_value=race;
run;
quit;
--
Paige Miller

View solution in original post

1 REPLY 1
PaigeMiller
Diamond | Level 26

Technically, if your model is a categorical variable as the independent variable, it's not really regression any more, it's Analysis of Variance, but the idea/concept is the same as regression.

 

proc glm data=have;
    class race;
    model change_in_value=race;
run;
quit;
--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1919 views
  • 2 likes
  • 2 in conversation