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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 697 views
  • 0 likes
  • 2 in conversation