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
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.
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.
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 lol you are right. Time to go home!
@ChrisNZ - too right. I'm out the door too!
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.
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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.