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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 829 views
  • 0 likes
  • 2 in conversation