Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I think the forum is a great idea, especially for those of us in consulting engineering. Keep up the good work!..."

Geography

Where in the world do Tek-Tips members come from?
ks01 (MIS)
14 Feb 12 0:21
Hi everyone ...

I am having an issue with the century portion of a date.  I am reading in a date value of YYMMDD using a YYMMDD6 informat.  

An example is 130113 for January 13, 2013.  When I write the value out in my put statement with a format of YYMMDD10, I'm getting the value 1913-01-13.  I am expecting 2013-01-13.

I have little experience with SAS and would appreciate any suggestion on how I can get my YYMMDD10 date values to write out with the correct century.

Thank you in advance!
sasbuddy (Programmer)
16 Feb 12 6:40
check with your YEARCUTOFF option.
You can use following statement at the start of your code.

options yearcutoff = 1920;

 

sasbuddy
http://sites.google.com/site/sasbuddy/
 

ks01 (MIS)
16 Feb 12 13:46
Hi sasbuddy ... thank you for the feedback.

I added your suggestion to my options statement, but it didn't seem to work.  Here is what I did:

CODE

OPTIONS NOSOURCE YEARCUTOFF = 1920       ;

From my input statement:

CODE

@45 ED_200_PURGE_DATE   YYMMDD6.

From my put statement:

CODE

@41 ED_200_PURGE_DATE   YYMMDD10.

From the SAS log, I see:

CODE

ED_100_EFFECT_DATE=19034

But in my output file I see:

CODE

PURGE DATE=1931-01-17

Would you have any suggestions?

Thank you in advance!
ks01 (MIS)
16 Feb 12 13:55
Sorry ... I pasted the wrong value from the SAS log ... it should have been:

CODE

ED_200_PURGE_DATE=-10576
 
sasbuddy (Programmer)
21 Feb 12 4:38
Hi,

if your input data is like '310117' and if you read it using yymmdd6. format with YEARCUTOFF = 1920. then It will give the date as 1931-01-17 and if you have '130117' as source data then the output with above code is 2013-01-17.

The way YEARCUTOFF option works is like; it takes next 100 yrs into consideration of the year value you specified.
and maches the century value accordingly.

So if you set the YEARCUTOFF = 1920 then it will take into conderation the 100 yrs span starting from 1920 to 2019.

and hence if the date in yymmdd6. format is 310117 it will treat it as 1931-01-17 and not 2031-01-17 as 1931 falls into the considered span and 2031 falls out side of that span.

You should choose the value of YEARCUTOFF option accordingly.

Or else if you want to fix the century part as 20th century only; then in that case I would suggest you to read that value in string format prepend the value with 20 and then process that as date in yymmdd8. format.


 

sasbuddy
http://sites.google.com/site/sasbuddy/
 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close