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