I have the following parts of some code I have:
proc import datafile="FILE_PATH"
out=sample_data
dbms=csv
replace;
getnames=yes;
run;
/* get current date and time for titles in AM/PM format */
%let current_datetime = %sysfunc(datetime(), datetimeampm.);
proc sql;
create table my_output as
SQL Code
quit;
title1 "First Name & Last Name";
title2 "Date and Time: ¤t_datetime";
title3 "Title of Output";
proc print data=my_output;
run;However, the title2 in my output shows up as:
| Date and Time: 2048615388.473 |
Why isn't it showing in a MM/DD/YYYY AM/PM format? How can I fix it?
SAS does not have FORMAT with that name.
69 %put current_datetime = %sysfunc(datetime(), datetimeampm.); ERROR: Format name DATETIMEAMPM. not found or the width and/or decimal specified for the format used are out of range. current_datetime = 2048627120.622
Did you mean to use the DATEAMPM format instead? Or perhaps DATEAMPM23.?
70 %put current_datetime = %sysfunc(datetime(), dateampm.); current_datetime = 30NOV24:11:08:28 PM 71 %put current_datetime = %sysfunc(datetime(), dateampm23.); current_datetime = 30NOV2024:11:09:40 PM
%let current_datetime = %sysfunc(datetime(), mdyampm.);
title1 "First Name & Last Name";
title2 "Date and Time: ¤t_datetime";
proc print data=sashelp.class;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
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.