0
votes

Most likely a silly question, but I must be overlooking something.

I have a date field in which sometimes the date is missing (.). I have to create a file against this data set, but the requirements to have this loaded into a DB2 environment are requesting that instead of native SAS null numeric value (.), they require it to be a blank string.

This should be a simple task, by first converting the variable to character, and using the appropriate format:

LAST_ATTEMPT = PUT(ATTMPT1,YYMMDDS10.);

When a proc contents is run on the data set, it confirms that this has been converted to a character variable.

The issue is that when I look at the data set, it still has the (.) for the missing values. In an attempt to convert the missing date(.) to a blank string, it then blanks out every value for the variable...

What am I missing here?

2

2 Answers

2
votes

Options MISSING=' ';

This will PUT blank for missing value when you execute your assignment.

0
votes

One way is to use Options MISSING=' ';, but this might have unwanted impact on other parts of your program.

Another safer way is just adding a test to the original program:

IF ATTMPT1~=. THEN LAST_ATTEMPT = PUT(ATTMPT1,YYMMDDS10.);
ELSE LAST_ATTEMPT = "";