BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lucazanotti
Fluorite | Level 6

Hi all, 


i am have a SAS dataset with several variables having the following format: ddMMMyyyyHH:MM:SS an example 02NOV2018:09:51:58.
I would like to change the format in dd/mm/yyyyhh:mm:ss so it would be 02/11/2018 09:51:58 .
Unfortunately some of the values are missing (.), thus when try the below code (found here) I am running in lots of fields ERROR, in addition if i try to enlarge the database SAS faile saying "An error occured executing the workspace XXX The server is disconnected":

 

Can you please help me?

Thanks

Luca

 

 

proc format;
picture mdyhms
other = '%0d/%0m/%Y %0H:%0M:%0S' (datatype=datetime);
run;


data try_format_mdyhms;
set mydata;
format date1 mdyhms.;

put date1:mdyhms.;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Expand your format:

proc format;
picture mdyhms
  . = "."
  other = '%0d/%0m/%Y %0H:%0M:%0S' (datatype=datetime)
;
run;

And do not use a put statement like that for all your observations, as that will explode the log and is most probably the cause for your server process crashing.

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

Expand your format:

proc format;
picture mdyhms
  . = "."
  other = '%0d/%0m/%Y %0H:%0M:%0S' (datatype=datetime)
;
run;

And do not use a put statement like that for all your observations, as that will explode the log and is most probably the cause for your server process crashing.

lucazanotti
Fluorite | Level 6

Hi Kurt,

 

that's right thanks a lot for the swift answer. 🙂

 

Regards

Luca

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
  • 899 views
  • 0 likes
  • 2 in conversation