BookmarkSubscribeRSS Feed
deleted_user
Not applicable
How can I handle the missing values in a field (VSTMD) thats a varchar datatype (sql table raw data) and that has to be written into a numeric SAS date field? Since it has "null" value, SAS considers as both character and numeric variable. How can this be resolved?
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
A SAS variable is either CHARACTER or NUMERIC, in type. Normally the SAS CHARACTER type variable is either blank or non-blank, and a SAS NUMERIC type variable is either considered to have a MISSING value or a non-MISSING value.

Since SAS DATE / DATETIME variables are NUMERIC type, you can set a missing value, such as MYDATE=. or if you attempt to use the INPUT function to convert a string to a date and the input-data is invalid, SAS will set the automatic variable _ERROR_=1 which is an indication of a problem - in addition to SAS setting the variable to a missing value, as well.

There is a MISSING function you may find the opportunity to use - check the SAS DOC.

Also, suggest reviewing the DOC on SAS variables.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

sas variable missing value site:sas.com

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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