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>;

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