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

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