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

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