My code was this:
data test.ds1;
set test.ds;
age=23;
gender=M;
run;
and my log window is showing this message:
data test.ds1; set test.ds; age=23; gender=M; run;
In this code, is there a variable called M in test.ds. There isn't is there, what you are trying to do is set gender to the value of a string of characters, hence you need to enclose that string of characters within quotes either single or double:
data test.ds1; set test.ds; age=23; gender="M"; run;
data test.ds1; set test.ds; age=23; gender=M; run;
In this code, is there a variable called M in test.ds. There isn't is there, what you are trying to do is set gender to the value of a string of characters, hence you need to enclose that string of characters within quotes either single or double:
data test.ds1; set test.ds; age=23; gender="M"; run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.