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

Hello. I have following data:

Sex 1 Male; 2 Female

Work (categorical variable) 1 White collar; 2 Pink; 3 Blue collar

Pain intensity (Categorical variable with 5 choices)

IDAgeSexWorkSick daysPain intensity 
13011254
22522203
33523142
45012131
54511102

 

I wanted to run linear regression (dep var= sick days; indep var= pain intensity) weighted by age, work and sex. 

 

proc reg data=data;
weight age work sex;
model Sick days= Pain intensity/clb;
run;

 

Once I run program, my output seems to have only weight for age. 

 

How can i run regression weighted by three variables. Isn't it possible to weight by categorical variables with more than 2 levels?

 

Thanks a lot in advance.

 

epid

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Any reason to not include the standard methods of 'adjusting' by including the variables in the model when doing a regression? Are you trying to develop something new or testing out a different type of modeling?

 

Otherwise the standard adjustments would make your code as:

 

proc glm data=data;
class work sex / param='ref';
model Sick days= Pain intensity work sex age / solution;
run;

@Epid wrote:

Thank you Reeza. 

 

Actually I don't mean that female weighs as twice important as men. Its just coding and i am seeking help to know if there is any solution in SAS to adjust or weight by creating dummy variable or etc. For example, if men is more likely to have sick days than women with same intensity of pain and if number of men involved in study is much higher than women, then should  I consider about adjusting sex for current regression?

 

Thanks again,

 

 


 

View solution in original post

4 REPLIES 4
Reeza
Super User

This doesn’t make sense to me. Weighting by arbitrary values will not yield correct results. For example if you code men as 1 and women as 2 you’ll get one result. Reverse the coding and you’ll likely get a different result. 

 

Can you explain what what you’re trying to do? If you have a reference for this methodology that may help. 

 


@Epid wrote:

Hello. I have following data:

Sex 1 Male; 2 Female

Work (categorical variable) 1 White collar; 2 Pink; 3 Blue collar

Pain intensity (Categorical variable with 5 choices)

ID Age Sex Work Sick days Pain intensity 
1 30 1 1 25 4
2 25 2 2 20 3
3 35 2 3 14 2
4 50 1 2 13 1
5 45 1 1 10 2

 

I wanted to run linear regression (dep var= sick days; indep var= pain intensity) weighted by age, work and sex. 

 

proc reg data=data;
weight age work sex;
model Sick days= Pain intensity/clb;
run;

 

Once I run program, my output seems to have only weight for age. 

 

How can i run regression weighted by three variables. Isn't it possible to weight by categorical variables with more than 2 levels?

 

Thanks a lot in advance.

 

epid


 

Epid
Fluorite | Level 6

Thank you Reeza. 

 

Actually I don't mean that female weighs as twice important as men. Its just coding and i am seeking help to know if there is any solution in SAS to adjust or weight by creating dummy variable or etc. For example, if men is more likely to have sick days than women with same intensity of pain and if number of men involved in study is much higher than women, then should  I consider about adjusting sex for current regression?

 

Thanks again,

 

 

Reeza
Super User

Any reason to not include the standard methods of 'adjusting' by including the variables in the model when doing a regression? Are you trying to develop something new or testing out a different type of modeling?

 

Otherwise the standard adjustments would make your code as:

 

proc glm data=data;
class work sex / param='ref';
model Sick days= Pain intensity work sex age / solution;
run;

@Epid wrote:

Thank you Reeza. 

 

Actually I don't mean that female weighs as twice important as men. Its just coding and i am seeking help to know if there is any solution in SAS to adjust or weight by creating dummy variable or etc. For example, if men is more likely to have sick days than women with same intensity of pain and if number of men involved in study is much higher than women, then should  I consider about adjusting sex for current regression?

 

Thanks again,

 

 


 

Epid
Fluorite | Level 6

Dear Reeza,

Thanks a lot. I decided to do as you suggested.

Epid

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 721 views
  • 1 like
  • 2 in conversation