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 🙂

sas-innovate-2024.png

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.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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