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?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.