Hello Everyone.
I am getting little Confused while converting Numeric to Character Format.
I am having Data Like..
Data Test;
input ID Start Date9. End Date9. Amount;
Format Start End Date9.;
datalines;
1 01Jan2012 1Jan2013 5000
1 01Feb2012 1Jan2013 5000
. 01mar2012 1Jan2013 5000
0 01apr2012 1Jan2013 5000
;
run;
Data h;
set test;
x=put(ID,8.);
run;
Above Code Working Perfectly but i am getting confused with 3rd observation in above data.
Normally as per my knowledge Missing Values in Num variables shows As ' . ' and in Char values shows as Blank ' '.
But in above Data Empty value in X(3rd OBs) showing as ' . '
Why this is behaving like this???
Regards.
Sanjeev.K
When you have a step you want to perform just some of the time, use an IF THEN statement:
if ID > . then X = put(ID, 8.);
When ID is missing, X will remain blank.
It shows dot because that is the value you PUT into it with PUT function.
Maybe you need options missing=' ';
Hi.
Thanks For your reply.
If we use missing= ' ' ,then it works fine for X variable ,but other Numeric Variables also effects.But i want to keep ' . ' in other numeric variables when there is no data.
Regards,
Sanjeev.K
Missing option does not change the value of numeric variables. Only the display. So set it back when you get done.
When you have a step you want to perform just some of the time, use an IF THEN statement:
if ID > . then X = put(ID, 8.);
When ID is missing, X will remain blank.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.