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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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 lock in 2025 pricing—just $495!

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