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;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for 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.