BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rajvir
Fluorite | Level 6

 

 

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

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

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".

View solution in original post

5 REPLIES 5
Reeza
Super User

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

rajvir
Fluorite | Level 6

the date is 12/08/1925,

SASKiwi
PROC Star

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.

Astounding
PROC Star

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".

rajvir
Fluorite | Level 6
Thanks now got it 🙂

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 3601 views
  • 7 likes
  • 4 in conversation