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?
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.