BookmarkSubscribeRSS Feed
mahender1
Fluorite | Level 6

Hello all,

kindly help me in converting the date values to ISO8601 format.

i have date values as :

TRTSTDT and TRENDT are NUMERIC type as below:

 

   TRSTDT            TRENDT

06DEC2007       20DEC2007

16JUN2009       30JUN2009

 

I want to convert them to CHARACTER variables as

RFSTDTC and RFENDTC to ISO8601 format,

 

 

Kindly help me.

 

 

 

 

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Whn you say ISO 8601 Format, does that mean that 06DEC2007 becomes 20071206? 🙂

Tom
Super User Tom
Super User

What did you try? SAS has a number of ISO  formats.  

https://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n0p2fmevfgj...

RFSTDTC = put(TRTSTDT,B8601DA8.);

Of course you could also just use the YYMMDDN format.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1063 views
  • 0 likes
  • 3 in conversation