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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 776 views
  • 0 likes
  • 3 in conversation