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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 7947 views
  • 4 likes
  • 4 in conversation