BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10

%LET inputlist= INPUT

 

State : $CHAR2.

Servicer : $CHAR25.

Date : /*$CHAR10.

The above is a snippet of code.  It handles input from a share folder in which the date is inputted as a numeric.  However because it is not recognized as an actual date the field shows a blank for that value.  The only way I know around this is to read it in as a character then attempt to convert to a date.  Is there a way to convert this to a date at initial input instead?  I tried placing an 8. after Date: 8. however that does not show the date

2 REPLIES 2
SASKiwi
PROC Star

We can't help unless you post what your date input data looks like and the actual full code that is reading it.

ballardw
Super User

@Q1983 wrote:

%LET inputlist= INPUT

 

State : $CHAR2.

Servicer : $CHAR25.

Date : /*$CHAR10.

The above is a snippet of code.  It handles input from a share folder in which the date is inputted as a numeric.  However because it is not recognized as an actual date the field shows a blank for that value.  The only way I know around this is to read it in as a character then attempt to convert to a date.  Is there a way to convert this to a date at initial input instead?  I tried placing an 8. after Date: 8. however that does not show the date


Depending on your source file format, practically anything not binary such as txt or CSV or tab delimited or fixed column, should not have a problem reading values using a format if you know which variable and which the format should be.

It might be as simple as using an INFORMAT statement before the input. It is a good idea to assign a display format as well so you aren't asking is 21347 the right value.

 

informat datevar date9. ;

format datevar date9.;

input <variables>      datevar  <more variables>;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 668 views
  • 0 likes
  • 3 in conversation