BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi All

I am having come issues changing the date format from dd/mm/yyyy to yyyymmdd.

Everything i do I get
ERROR 48-59: The format $YYMMDD was not found or could not be loaded.

Here is my SAS program which is run on the mainframe:

OPTIONS ERRORABEND;

DATA ONE;
LENGTH INVDATEL $10.;
LENGTH INV_NO $06.;
LENGTH NETDUEDATE $10.;

INFILE DMINPUT DELIMITER = ',' MISSOVER;


INPUT
INV_HEADER_TYPE $
NETDUEDATE $
INV_NO $
;
CURRENTDATE = DATE();
NETDUEDATE2=PUT(NETDUEDATE,YYMMDD6.);

DATA SENDIT;
SET ONE;
FILE DMOUTPT;
PUT @029 NETDUEDATE2 YYMMDD6.
;

Thanks for your help
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You are attempting to use a PUT where you need to be using an INPUT. The code you have shared is reading up your "date-string" as character with the specified INFORMAT in your INPUT statement.

To convert that character string to a SAS numeric DATE variable, you need to use the INPUT function with the specific INFORMAT based on the string.

Also, with your INFILE statement, you may want to explore whether or not the DSD parameter may be needed, if you might have null input fields to read up.

Scott Barry
SBBWorks, Inc.


Step-by-Step Programming with Base SAS Software, Working with Dates in the SAS System
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001304321.htm

SAS Language Reference: Dictionary, Informats
http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000309877.htm

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
  • 1 reply
  • 877 views
  • 0 likes
  • 2 in conversation