Hi,
I have categorical variables in the logistic regression and I'd like to label their values in output, so instead of having 1,2,3 etc. I'd like to have names of ethnic groups. Is there a way to do that?
Thank you!
Analysis of Maximum Likelihood Estimates | ||||||
Parameter | DF | Estimate | Standard | Wald | Pr > ChiSq | |
Error | Chi-Square | |||||
Intercept | 1 | -30.9965 | 220.3 | 0.0198 | 0.8881 | |
race | 1 | 1 | 13.295 | 186.4 | 0.0051 | 0.9431 |
race | 2 | 1 | -3.7821 | 392.2 | 0.0001 | 0.9923 |
race | 3 | 1 | -2.33 | 514.4 | 0 | 0.9964 |
race | 4 | 1 | -2.1724 | 472.6 | 0 | 0.9963 |
race | 5 | 1 | -1.5253 | 725.1 | 0 | 0.9983 |
race | 6 | 1 | -1.9817 | 580.2 | 0 | 0.9973 |
Use a format, something like this:
proc format;
value $racef. '1'='Martian' '2'='Venusian' '3'='Earthling';
run;
proc logistic data=whatever;
...
format race $racef.;
run;
Use a format, something like this:
proc format;
value $racef. '1'='Martian' '2'='Venusian' '3'='Earthling';
run;
proc logistic data=whatever;
...
format race $racef.;
run;
Great! Thank you very much!
Correcting a typographical error — no dot after $racef in PROC FORMAT
proc format;
value $racef '1'='Martian' '2'='Venusian' '3'='Earthling';
run;
proc logistic data=whatever;
...
format race $racef.;
run;
Sorry for more trouble, but I have a follow up question. Format worked just fine, in terms of formatting the output. The problem is that when I run the code with format it drops some estimates. Is there a reason why it's doing it?
Here is output without format:
Analysis of Maximum Likelihood Estimates | ||||||
Parameter | DF | Estimate | Standard | Wald | Pr > ChiSq | |
Error | Chi-Square | |||||
Intercept | 1 | -30.9965 | 220.3 | 0.0198 | 0.8881 | |
race | 1 | 1 | 13.295 | 186.4 | 0.0051 | 0.9431 |
race | 2 | 1 | -3.7821 | 392.2 | 0.0001 | 0.9923 |
race | 3 | 1 | -2.33 | 514.4 | 0 | 0.9964 |
race | 4 | 1 | -2.1724 | 472.6 | 0 | 0.9963 |
race | 5 | 1 | -1.5253 | 725.1 | 0 | 0.9983 |
race | 6 | 1 | -1.9817 | 580.2 | 0 | 0.9973 |
race | 7 | 1 | -2.2975 | 576.2 | 0 | 0.9968 |
race | 8 | 1 | -1.4041 | 709.9 | 0 | 0.9984 |
race | 9 | 1 | -2.2255 | 849 | 0 | 0.9979 |
race | 10 | 1 | -2.6247 | 567.1 | 0 | 0.9963 |
race | 11 | 1 | -3.034 | 1310.9 | 0 | 0.9982 |
race | 12 | 1 | 13.7587 | 186.4 | 0.0054 | 0.9412 |
And here is the output when I add format:
Analysis of Maximum Likelihood Estimates | ||||||
Parameter | DF | Estimate | Standard | Wald | Pr > ChiSq | |
Error | Chi-Square | |||||
Intercept | 1 | -30.2701 | 918.8 | 0.0011 | 0.9737 | |
race | Aboriginal | 1 | 13.5539 | 115.8 | 0.0137 | 0.9068 |
race | Arab | 1 | -2.1409 | 416.6 | 0 | 0.9959 |
race | Black | 1 | -2.2589 | 382.7 | 0 | 0.9953 |
race | Chinese | 0 | 0 | . | . | . |
race | Filipino | 0 | 0 | . | . | . |
race | Japanese | 0 | 0 | . | . | . |
race | Korean | 0 | 0 | . | . | . |
race | Latin American | 0 | 0 | . | . | . |
race | Other | 1 | -2.7809 | 271.4 | 0.0001 | 0.9918 |
race | South Asian | 1 | -3.7314 | 300.6 | 0.0002 | 0.9901 |
race | Southeast Asian | 0 | 0 | . | . | . |
race | West Asian | 0 | 0 | . | . | . |
thank you,
i.
We need to see the code you used, and (a portion of) the RAW data.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.