BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
merveayibogan
Fluorite | Level 6

I have a date variable with the YYMMDDN8. format. However, some values are displayed as E. From the frequency table, I understand that these are the missing values. So I want to replace them with December 31, 2023.  This is how the data looks. I tried to replace Es, .s, it didn't work.

 

merveayibogan_0-1707038919675.png

DATA Zeynep.ccmxpfadjusted;
SET Zeynep.ccmxpf_lnkused;
IF ULINKENDDT = .......... THEN ULINKENDDT =..........; 
RUN;

 

How should i proceed ? Many thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

The "E" is most probably caused by a setting of the MISSING system option. It only affects the display of the value, in code it is always represented by a dot. So code it like this:

if ulinkenddt = . then ulinkenddt = '31dec2023'd;

or

ulinkenddt = coalesce(ulinkenddt,'31dec2023'd);

as the COALESCE function will return the first non-missing argument.

 

View solution in original post

3 REPLIES 3
Kurt_Bremser
Super User

The "E" is most probably caused by a setting of the MISSING system option. It only affects the display of the value, in code it is always represented by a dot. So code it like this:

if ulinkenddt = . then ulinkenddt = '31dec2023'd;

or

ulinkenddt = coalesce(ulinkenddt,'31dec2023'd);

as the COALESCE function will return the first non-missing argument.

 

Astounding
PROC Star

The coalesce function would work, as @Kurt_Bremser suggested.  You could also write an IF/THEN statement as you suggested, along these lines:

IF ULINKENDDT <= .Z THEN ULINKENDDT = '31dec2023'd; 
Tom
Super User Tom
Super User

If the value is special missing .E then it will DISPLAY as just an E.

To enter a date constant you need to use a string that the DATE informat can understand.  It does not matter what display format you have attached to the variable that contains date values.

 

So you should use this code to change .E to 31DEC2023.

IF ULINKENDDT = .E THEN ULINKENDDT = '31DEC2023'd ;

 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1792 views
  • 0 likes
  • 4 in conversation