Hi,
I was wondering if anyone could help me. My input statements don't seem to work for me for some reason. Can anyone see why and explain to me what I did wrong please? Thank you!
You're simply using the wrong informat. Your character dates are in YMD order, so you have to use the proper YYMMDD10. informat.
Your input-statements generate missing values, calculations with missing-values always result in missing values. What do you expect as value for relday if compdate and/or icdate is missing?
if nmiss(compdate, icdate) = 0 then do;
elday = compdate-icdate + 1;
end;
else do;
elday = .;
end;
I played around with the code a little more and this is what I have now but I'm still getting the same message.
The problem is NOT the input-function, but the calculation using the variables set by the input-functions.
You're simply using the wrong informat. Your character dates are in YMD order, so you have to use the proper YYMMDD10. informat.
You will need to inspect your data. (Obviously, we can't help with that.)
These are the suspect variables:
INFORMED_CONSENT_OBTAINED
COMPLETED_STUDY
The programming statements expect these to be character, in the date9 format, something like: 04Mar2019
Somehow, the actual data doesn't match the expected values. So the first step is to find out what is actually in these variables.
****************** EDITED:
So you are playing around with these:
date9.
mmddyy10.
without really understanding what they mean.
First, run a PROC CONTENTS to determine whether the two key variables are character or numeric. Assuming they are character, their format in the log messages corresponds to:
yymmdd10.
Ah got it thank you!!
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.