View previous topic :: View next topic
|
Author |
Message |
ap_mainframes
Active User
Joined: 29 Dec 2005 Posts: 181 Location: Canada
|
|
|
|
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 |
|
|
cpuhawg
Active User
Joined: 14 Jun 2006 Posts: 331 Location: Jacksonville, FL
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
ap_mainframes
Active User
Joined: 29 Dec 2005 Posts: 181 Location: Canada
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Glad to hear it worked. |
|
Back to top |
|
|
|