Good day expect.
am running the below script and and am getting the this error message
PROC SQL;
CREATE TABLE INSTA_A AS
SELECT INPUT(PUT(COMPRESS(INPUT(PUT(ACC_NO,13.),$13.)||PUT(SERIAL_NO,Z3.)),$16.),16.) AS ACCOUNT
,A_COMM_DT AS COMM_DT
,A_EXP_DT AS EXP_DT
,'A' AS INSTRUCTION
FROM VBM.INST_A
WHERE INPUT(PUT(A_COMM_DT,Z8.),YYMMDD8.) > TODAY() + 365
;
QUIT;
You can make the error MESSAGE go away by adding the ? modifier before the informat.
input(put(a_comm_dt,z8.),?yymmdd8.) > today() + 365
But those records with invalid A_COMM_DT values will be excluded by your WHERE clause because missing values are less than any valid value.
You should look at the observations with the invalid dates and decide what to do with them.
data check;
set VBM.INST_A;
if missing(INPUT(PUT(A_COMM_DT,Z8.),??YYMMDD8.)) and not missing(A_COMM_DT) ;
run;
Without knowing the A_COMM_DT values, it's hard to tell what is causing the error.
Still my guess is you have an A_COMM_DT value that doesn't fit the YYMMDD8. format e.g. 20210231 (no 31st of Feb)
The following will replicate your error
data have ;
infile cards ;
input a_comm_dt ;
cards ;
20230315
20230415
20230515
20230229
;
proc sql ;
select
a_comm_dt as comm_dt
from
have
where
input(put(a_comm_dt,z8.),yymmdd8.) > today() + 365
;
quit ;
here are the values of A_COMM_DT
20220228
20210911
Yes it does replicate my error
@Rixile106 You need to look at the values you have and check for invalid dates.
The error message is clear, it's telling you a date value in your data is not valid e.g. 20211301, 20210229, etc.
Could it be something else? Yes, but that is very unlikely.
I'd start with the obvious, go look at the data, specifically
You can make the error MESSAGE go away by adding the ? modifier before the informat.
input(put(a_comm_dt,z8.),?yymmdd8.) > today() + 365
But those records with invalid A_COMM_DT values will be excluded by your WHERE clause because missing values are less than any valid value.
You should look at the observations with the invalid dates and decide what to do with them.
data check;
set VBM.INST_A;
if missing(INPUT(PUT(A_COMM_DT,Z8.),??YYMMDD8.)) and not missing(A_COMM_DT) ;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.