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

Hello community,

I would like to know how I could bring in the following formats for the variable "ATTRACTL" into my model output, so that the labels indicated by the formats can be seen in the model output...

"bothstatusNew" is a four level variable, I'm attempting simple multinomial regression with this code.

Or is it easiest to change the numeric level coding into character form coding using a data step and length statement for the predictor variable?

Thank you. Here I provide an example code:

Data psw.NewVar6;

  set psw.NewVar5;

proc format;

value ATTRACTL

0 = 'Only Male'

1='Male and Female'

2= 'Only Female'

3= 'None'

;

run;

proc freq Data=psw.NewVar6;

tables ATTRACTL;

format ATTRACTL ATTRACTL.;

run;

proc logistic data = psw.NewVar6;

class ATTRACTL;

model bothstatusNEW = ATTRACTL;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
Macyhe22
Calcite | Level 5

Sorry forgot to add bothstatusNEW to the class statement in the model code. This is the correction:

proc logistic data = psw.NewVar6;

class bothstatusNEW ATTRACTL;

model bothstatusNEW = ATTRACTL;

run;

View solution in original post

4 REPLIES 4
Macyhe22
Calcite | Level 5

Sorry forgot to add bothstatusNEW to the class statement in the model code. This is the correction:

proc logistic data = psw.NewVar6;

class bothstatusNEW ATTRACTL;

model bothstatusNEW = ATTRACTL;

run;

ballardw
Super User

Add the same format statement to the proc logistic code.

Format is one of those statements that are available in almost every proc that displays or manipulates data without an explicit entry in the syntax.

A big advantage to the format approach is that if you want to see the results for a different grouping of values is to create a new format and apply that in the code instead of having to go back to a data step and add a new variable.

Such as:

proc format;

value ATTRACTLALt

0,2 = 'Only Male or Only Female'

1='Male and Female'

3= 'None'

;

run;

Macyhe22
Calcite | Level 5

So do I place my format code within the model statement before the run command and after the model statement for example?

Macyhe22
Calcite | Level 5

Scratch that, thank you Ballard I believe I understand what your are saying thank you for your response!!!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1485 views
  • 3 likes
  • 2 in conversation