Hi
I have following csv data
sample data:
id,created_date,modified_date
1021,12/23/2014 12:12:37 AM,9/21/2015 09:56:02 AM
1024,09/12/2015 04:24:00 PM,10/21/2015 11:44:03 AM
I have code:
DATA sample;
INFILE '/path/file' dsd dlm=',' firstobs=2 ;
ATTRIB
id informat = $5. format=$5.;
created_date informat=mdyampm. format=mdyampm.
modified_date informat=mdyampm. format=mdyampm. ;
INPUT id $ created_date Modified_date;
;run;
in My out put I am getting values for date variables like 9/21/2015 09:56:02 AM.
How Can I get dates like 9/21/2015 21:56:02 or datestamp (24 hours format without AM, PM). What is the right format I need to use for dates.
Thank you
If none of the OOTB formats is what you want..
...then you can always create your own picture format
http://support.sas.com/kb/24/621.html
If none of the OOTB formats is what you want..
...then you can always create your own picture format
http://support.sas.com/kb/24/621.html
Thank you for suggesting me PICTURE statement. Can we store customized date format in dataset?, I applied user defined format in PUT statement, PROC PRINT its working perfectly fine.
I have a dataset named Inventory as below:
Inv_no | Record_dt |
102 | 10Oct2015:14:00:00 |
103 | 12Oct2015:09:00:30 |
I tried with following code:
proc format;
picture limdate other='%0m/%0d/%0Y %0H:%0M:%0S' (datatype=datetime);
run;
data new_inv;
retain inv_no record_dt;
set inventory ;
format record_dt limdate.;
run;
but I am not successful.
so proc format Picture statement is only to display or presentation.???
Please suggest me if there is any way I can accomplish.
Thank you
All formats are "for display only" and you can assign a picture format permanently to a variable like any other type of format.
If you assign a format permanenly (eg. with a format statement) to a permanent dataset then please be aware that you also need to store the format itself into a permanent catalog (or re-run the Proc Format at the beginning of a new session).
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!
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.