I would like to convert the date format ddmmmyyyy:hh:mm:ss to dd-mm-yyyy hh:mm:ss so European standard.
I have been looking for a solution for some time but have not yet been able to find a clear example.
I work with SAS Data Integration Studio. Any help is appreciated
The photograph makes it looks like you have defined something to be calculated as the value of the DATETIME() function.
If you want to instead define it as a string that looks the way you want then use this as the expression:
catx(' ',put(date(),ddmmyyd10.),put(time(),time8.))
But that will create a CHARACTER variable and not the NUMERIC variable your current expression is creating.
I don't know if it exists out-the-box. You can always roll out your own like this
proc format;
picture dtfmt (default=19)
low - high = '0%d-0%m-%Y 0%H:0%M:0%S' (datatype=datetime)
;
run;
data _null_;
dt = 0;
put dt dtfmt.;
run;
I have no idea about SAS DIS 🙂
@Cugel wrote:
Hello Peter,
Thanks for your response.
However, I work with the graphics side of SAS DIS.
To my knowledge, your solution cannot be applied here.
In the expression field I have included the datetime().
So now the datetime() must be displayed in dd-mm-yyyy hh: mm: ss.
Greetings Jos
[cid:image001.png@01D6EA82.C173AD00]
You might provide an explicit use case. If it is that DI specific then perhaps we should move this to the DI section such as Data Management in Solutions.
I know that some of the graphics don't like certain custom formats in other parts of SAS. Very few graphs that made much sense actually use datetime values directly because the text is so long it is either cumbersome or occupies too much graph space.
So there may be workarounds by providing other variables or label options.
You can create a custom format in a code node, and define the FMTSEARCH ootion in the precode for your job.
The documentation contains examples.
See FORMAT Procedure, particularly the PICTURE Statement, and the FMTSEARCH= System Option.
The FMTSEARCH option lists the catalogs or libraries where SAS goes looking for defined formats (defined formats are stored as catalog entries). If only a single-level library name is supplied, SAS assumes that there is a catalog named FORMATS there.
I would like to convert the date format ddmmmyyyy:hh:mm:ss to dd-mm-yyyy hh:mm:ss so European standard.
I have been looking for a solution for some time but have not yet been able to find a clear example.
I work with the graphics side of SAS Data Integration Studio.
Any help is appreciated.
datetime() format is now ddmmmyyyy:hh:mm:ss and I would like dd-mm-yyyy hh:mm:ss (European standard).
> datetime() format is now ddmmmyyyy:hh:mm:ss
1. datetime() is not a format, it is a function
2. You have no format in place at the moment, so I don't see the conversion you are referring to:
I would like to convert the date format ddmmmyyyy:hh:mm:ss to dd-mm-yyyy hh:mm:ss so European standard.
3. You need to see the name of your custom-built format (see @PeterClemmensen 's reply) in the format box.
The photograph makes it looks like you have defined something to be calculated as the value of the DATETIME() function.
If you want to instead define it as a string that looks the way you want then use this as the expression:
catx(' ',put(date(),ddmmyyd10.),put(time(),time8.))
But that will create a CHARACTER variable and not the NUMERIC variable your current expression is creating.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.