BookmarkSubscribeRSS Feed
Smitha9
Fluorite | Level 6

Hi I would like to change the two different date formats

Old: 2018-02-16     New: 20180216

Old:01FEB2018     New: 20180201

 

 I hope this works in SAS.

 

thanks

2 REPLIES 2
PaigeMiller
Diamond | Level 26

If these are numeric variables, then just change the format.

 

format variable_name yymmddn8.;
--
Paige Miller
Tom
Super User Tom
Super User

Are those two observations in the same dataset?  If so then OLD must be a character variable.

What type of variable do you want to create for NEW?  Do you want date values that are formatted in that style that saves two characters when printed but will confuse humans into not noticing that they should think of them as dates?  Or do you want to store that 8 digit string into a character variable?

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 save with the early bird rate—just $795!

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
  • 1249 views
  • 0 likes
  • 3 in conversation