Hello,
I am trying to merge the "independent" and "something else" categories into one category. and when I used this code SAS exclude them from the analysis
here is the code that I use
"if (POLITIC in (2,4) ) then POLITIC = 'Independent and others';
run;
Any suggestions on how to merge those two categories into one?
@almatruk wrote:
Hello,
I am trying to merge the "independent" and "something else" categories into one category. and when I used this code SAS exclude them from the analysis
here is the code that I use
"if (POLITIC in (2,4) ) then POLITIC = 'Independent and others';
run;
Any suggestions on how to merge those two categories into one?
If variable POLITIC in (2,4) it must be numeric, and you cannot then assign a character string to the variable POLITIC. SAS will not allow this. A better solution (assuming POLITIC is numeric) is the following:
proc format;
value politicf 1='Martian' 2,4='Independent and others' 3='Vulcan' 5='Klingon';
run;
and then assign the format POLITICF to your variable in a procedure or in a data step
format politic politicf.;
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 save with the early bird rate—just $795!
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.