BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
samgautam007
Fluorite | Level 6

Dear Mentors,

 

I am running a piece of code vis shell script through putty which uses the below line:

 

INPUT(PUT(DATEPART(A1.Date), YYMMDD8.), YYMMDDN8.)

 

and I am getting error as below:

 

ERROR: The informat YYMMDDN was not found or could not be loaded.

 

However, when i ran the same code in SAS Studio, it runs smoothly.

 

Please help.

 

Thanks in Advance.

 

Sandeep

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

The PUT and INPUT functions appear to be redundant as DATEPART creates a SAS data to start with. Try this:

 

DATEPART(A1.Date) format = YYMMDD8.

View solution in original post

6 REPLIES 6
ChrisNZ
Tourmaline | Level 20

There is not YYMMDDN informat supplied by SAS.

Maybe is it a user-created informat that is available in one environment..

Either way just remove the n and your code should run fine.

 

SASKiwi
PROC Star

The PUT and INPUT functions appear to be redundant as DATEPART creates a SAS data to start with. Try this:

 

DATEPART(A1.Date) format = YYMMDD8.
SASKiwi
PROC Star

@ChrisNZ - too right. I'm out the door too!

samgautam007
Fluorite | Level 6

Thanks @ChrisNZ and @SASKiwi for your inputs.

 

I have executed below command:

 

data a;
z=input(put(today(),yymmddn8.),yymmddn8.);
run;

data b;
z=input(put(today(),yymmddn8.),yymmdd8.);
run;

proc sql;
create table c as
select *,input(put(today(),yymmddn8.),yymmddn8.) as v from a
;quit;

 

And I am surprised why Proc sql is not throwing error.

 

Your help is much appreciated.

 

Kurt_Bremser
Super User
  • there is no informat yymmddn8. in default SAS, period.
  • your code is equivalent to
data a;
z=today();
run;

data b;
z=today();
run;

proc sql;
create table c as
select *, today() as v from a
;
quit;

The whole put/input thing makes no sense, as it does not change values in any way.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 9033 views
  • 4 likes
  • 4 in conversation