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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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