IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Date conversion : Julian to YYMMDD in SAS


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Thu Dec 04, 2008 1:32 am
Reply with quote

Hi,

I want to convert a Julian date to format YYMMDD in SAS
Can someone pls advice how to do that ??


thanks
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Thu Dec 04, 2008 3:19 am
Reply with quote

Code:

     JULDTE = DATEJUL(08338);               
     YYMMDD = PUT(JULDTE,YYMMDD6.);         


Your julian goes into the DATEJUL function and is converted to a SAS numerical date stored in the JULDTE variable. The PUT function loads the JULDTE variable into the YYMMDD format and is now loaded into variable YYMMDD.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Dec 04, 2008 5:25 am
Reply with quote

For input, use JULIANw. or PDJULw. (if packed) format to read in the Julian date. Then use a FORMAT varname YYMMDD6. ; to output as YYMMDD6. format. SAS dates are stored as an integer number of days since January 1, 1960 and can be output as desired by using the FORMAT statement.
Back to top
View user's profile Send private message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Thu Dec 04, 2008 6:26 am
Reply with quote

Thanks all, it work for me. Pls see the code below:

Code:
REG_DTE    $CHAR7
REG_DTE1  = DATEJUL(REG_DTE)
PUT @1  REG_DTE1  MMDDYY6.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Dec 04, 2008 7:11 am
Reply with quote

Glad to hear it worked.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top