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

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  
ParameterDFEstimateStandardWaldPr > ChiSq
    ErrorChi-Square
Intercept 1-30.9965220.30.01980.8881
race1113.295186.40.00510.9431
race21-3.7821392.20.00010.9923
race31-2.33514.400.9964
race41-2.1724472.600.9963
race51-1.5253725.100.9983
race61-1.9817580.200.9973
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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;
--
Paige Miller

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

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;
--
Paige Miller
PaigeMiller
Diamond | Level 26

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;
--
Paige Miller
AbuYusuf
Calcite | Level 5

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  
ParameterDFEstimateStandardWaldPr > ChiSq
    ErrorChi-Square
Intercept 1-30.9965220.30.01980.8881
race1113.295186.40.00510.9431
race21-3.7821392.20.00010.9923
race31-2.33514.400.9964
race41-2.1724472.600.9963
race51-1.5253725.100.9983
race61-1.9817580.200.9973
race71-2.2975576.200.9968
race81-1.4041709.900.9984
race91-2.225584900.9979
race101-2.6247567.100.9963
race111-3.0341310.900.9982
race12113.7587186.40.00540.9412

 

And here is the output when I add format:

Analysis of Maximum Likelihood Estimates  
ParameterDFEstimateStandardWaldPr > ChiSq
    ErrorChi-Square
Intercept 1-30.2701918.80.00110.9737
raceAboriginal113.5539115.80.01370.9068
raceArab1-2.1409416.600.9959
raceBlack1-2.2589382.700.9953
raceChinese00...
raceFilipino00...
raceJapanese00...
raceKorean00...
raceLatin American00...
raceOther1-2.7809271.40.00010.9918
raceSouth Asian1-3.7314300.60.00020.9901
raceSoutheast Asian00...
raceWest Asian00...

 

thank you,

i.

PaigeMiller
Diamond | Level 26

We need to see the code you used, and (a portion of) the RAW data.

--
Paige Miller

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!
What is Bayesian Analysis?

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.

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
  • 5 replies
  • 916 views
  • 0 likes
  • 2 in conversation