BookmarkSubscribeRSS Feed
emmasongrace
Calcite | Level 5

Hi, I am a graduate student who is very new to SAS. I am trying to dichotomize a variable to use for logistic regression. The code in the top block ran fine and the new variables were created, but the bottom code will not run. Does anybody see any obvious errors?

 

Thank you so much. 

 

Kindly, 

 

Emmason

Screen Shot 2020-09-25 at 12.05.02 PM.png

3 REPLIES 3
Reeza
Super User

You do not need to dichotomize the variables, the CLASS statement will account for that correct, the last example is the most relevant.

 

https://stats.idre.ucla.edu/unlinked/sas-logistic/proc-logistic-and-logistic-regression-models/

 


@emmasongrace wrote:

Hi, I am a graduate student who is very new to SAS. I am trying to dichotomize a variable to use for logistic regression. The code in the top block ran fine and the new variables were created, but the bottom code will not run. Does anybody see any obvious errors?

 

Thank you so much. 

 

Kindly, 

 

Emmason

Screen Shot 2020-09-25 at 12.05.02 PM.png


 

Reeza
Super User
Your first set of code is wrong, it's missing a SET statement.

Your second is correct, if it's not working explain why/how and post your code as TEXT (not an image) with the log.
ballardw
Super User

When I see code like your first data step my first question is "Are there values between 3 and 5?"

 

I see a potential for many missing values in your Covidthreat variable. Any values that have mixed values for the 3 dichotomous variables with the code shown will have the threat missing. Which means that either the record will not be used by your model (any variable with missing values used on a model statement will cause the record to be excluded) or you would have to specify the missing option on a class statement and in effect have a 3 level variable.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 846 views
  • 0 likes
  • 3 in conversation