1)Suppose the YEARCUTOFF= system option is set to 1920. An input file contains the date expression 12/08/1925, which is being read with the MMDDYY8. informat. Which date will appear in your data?
: The answer is 08DEC2019
I felt the answer would be 08DEC1925 , as 1920-2019 will be range if yearcutoff=1920.
Experts pls help me out with this problem.
Thanks
Raj
Just saying the same thing in different words ...
The MMDDYY8 informat means, "Read 8 characters. Expect them to be in month+day+year form. Interpret and convert what you find within those 8 characters."
So the data contains 12/08/1925. But the MMDDYY8 informat specifically instructs the software to read the first 8 of those 10 characters. It never reads the "25" at the end, only the "12/08/19".
Your issue isn't with YEARCUTOFF per se, but with the format.
If it's MMDDYY10 - it uses the whole year.
But if it's MMDDYY8 - it sees
12/08/19 -> 2019
the date is 12/08/1925,
Your informat should be MMDDYY10. - the length includes the forward slashes. This is a data truncation problem - you are reading 12/08/19 when you should be reading 12/08/1925. The YEARCUTOFF option is irrelevant in this case as you have the complete date including the century.
Just saying the same thing in different words ...
The MMDDYY8 informat means, "Read 8 characters. Expect them to be in month+day+year form. Interpret and convert what you find within those 8 characters."
So the data contains 12/08/1925. But the MMDDYY8 informat specifically instructs the software to read the first 8 of those 10 characters. It never reads the "25" at the end, only the "12/08/19".
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.