MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Handling dates in SAS of format CYYMMDD

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
er_hariiharan@yahoo.com
Beginner


Joined: 06 May 2006
Posts: 1
Topics: 1

PostPosted: Sat May 06, 2006 4:18 am    Post subject: Handling dates in SAS of format CYYMMDD Reply with quote

Hi All
I am working with Mainframe SAS 8.2 version. I have a file which consists of a date field with non-conventional CYYMMDD format. When I searched in the SAS online documentation, handling this kind of informat was not found. Could anyone help me in this regard.?

My objective is to read this date field and to convert it into any other SAS readable format say MMDDYYYY.
_________________
Best Regards
Hariharan
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Sat May 06, 2006 7:20 am    Post subject: Reply with quote

er_hariiharan@yahoo.com,

Assuming a value of 0 for 'c' indicates the 20th century (i.e. 19nn) and a value of 1 indicates the 21st century (i.e. 20nn). This technique adds 19,000,000 to the numeric value, which adjusts it to the format of yyyymmdd, then uses the PUT and INPUT functions with the YYMMDD8. Try this

Code:

  DATA TEST;                                       
       INP_DATE = 0990503;                         
       INP_DATE = INP_DATE + 19000000;             
       SASDATE = INPUT(PUT(INP_DATE,8.),YYMMDD8.);
       FORMAT SASDATE MMDDYYN8.;                   
  RUN;                                             
  PROC PRINT;RUN;                                 


Hope this helps..

Cheers

Kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
advoss
Beginner


Joined: 23 Aug 2005
Posts: 26
Topics: 0

PostPosted: Mon May 08, 2006 11:30 am    Post subject: Reply with quote

We had a similar situation here, where C=1 for 1900 and C=2 for 2000. So, if that is your situation, just change 19000000 in Kolusu's example to 18000000 (or 18E6 if you're lazy like me and don't like counting zeroes). This will handle birthdates in the 1800's if you have to worry about such things.
_________________
Alan Voss
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group