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".
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.