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
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,
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
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,
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,
Dear Reeza,
Thanks a lot. I decided to do as you suggested.
Epid
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.