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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.