How do I covert N and O to 1 and 0 to do correlation and regression analysis? Please help me with this.
What PROC are you using for regression?
If it's PROC LOGISTIC or GLM (and several others) you can use a CLASS statement to specify this is a categorical variable. You'll also want to specify the reference level but you don't need to convert them to 0/1 manually. Otherwise you can use IF/THEN statements to make a new variable.
@serakuru1989 wrote:
How do I covert N and O to 1 and 0 to do correlation and regression analysis? Please help me with this.
if varName = "N" then varName_Cat = 0;
else if varName = "O" then varName_Cat = 1;
I am very much new in this. Using PROC Logistic.
How do I write a CLASS statement to specify this is a categorical variable?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.