BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ananyayadav
Calcite | Level 5

My code was this:

 

data test.ds1;
set test.ds;
age=23;
gender=M;
run;

 

and my log window is showing this message:

 

NOTE: Variable M is uninitialized.
NOTE: There were 1 observations read from the data set TEST.DS.
NOTE: The data set TEST.DS1 has 1 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.23 seconds
cpu time 0.14 seconds
 
Can anyone please clarify where i am wrong?
1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26
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;

 

View solution in original post

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26
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-wordmark-2025-midnight.png

Register Today!

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.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 777 views
  • 0 likes
  • 2 in conversation