We have a csv that is the result of my SAS data set dataout. we are getting date and time value as dd.mm.yyyy hh:mm AM/PM but we need the values as mm.dd.yyyy hh:mm format this is in our newly installed SAS Environment which is running on M8 and we have old sas environment running on M7. Same code we execute on our old environment, but we are getting output as expected format mm.dd.yyyy hh:mm , We don't want to modify the sas code but we would like to know if we can achieve this via some user properties change or some configuration change. we are not aware how to do that, but our old sas environment is configured by some who is not available currently.
I would be surprised if the CSV file (which is just a text file) had either of those styles for datetime values. They are not common ways for SAS to display datetime values.
Are you sure that you are not talking about how EXCEL has decided to display the values it read from the CSV file.
Take a look at the generated CSV file itself using a text editor. or just use a simple SAS data step to dump the first few lines from the file into the SAS log so you can check.
data _null_;
infile 'myfile.csv' obs=5;
input;
list;
run;
Here are what the available datetime formats on my installation of SAS look like.
73 data datetime; 74 set sashelp.vformat ; 75 where fmtinfo(fmtname,'cat')='datetime'; 76 where also fmttype='F'; NOTE: WHERE clause has been augmented. 77 now=%sysfunc(datetime()); 78 length string $68; 79 string=putn(now,cats(fmtname,min(68,maxw))); 80 put fmtname $12. string $char68. ; 81 run; AFRDFDT 04Mrt2025:10:17:56 B8601DN 20250304 B8601DT 20250304T101756 B8601DX 20250304T051756-0500 B8601DZ 20250304T101756+0000 CATDFDT 04Mar2025:10:17:56 CRODFDT 04ožu2025:10:17:56 CSYDFDT 04b?ezen2025:10:17:56 DANDFDT 04mar2025:10:17:56 DATEAMPM 04MAR2025:10:17:56 AM DATETIME 04MAR2025:10:17:56 DESDFDT 04Mrz2025:10:17:56 DEUDFDT 04Mrz2025:10:17:56 DTDATE 04MAR2025 DTMONYY MAR2025 DTWKDATX Tuesday, 4 March 2025 DTYEAR 2025 DTYYQC 2025:1 E8601DN 2025-03-04 E8601DT 2025-03-04T10:17:56 E8601DX 2025-03-04T05:17:56-05:00 E8601DZ 2025-03-04T10:17:56+00:00 ENGDFDT 04MAR2025:10:17:56 ESPDFDT 04mar2025:10:17:56 EURDFDT 04MAR2025:10:17:56 FINDFDT 4.3.2025:10:17:56 FRADFDT 04mar2025:10:17:56 FRSDFDT 04mar2025:10:17:56 HUNDFDT 25.márc.4. 10:17:56 IS8601DN 2025-03-04 IS8601DT 2025-03-04T10:17:56 IS8601DZ 2025-03-04T10:17:56+00:00 ITADFDT 04Mar2025:10:17:56 JDATEYT JDATEYTW JNENGOT JNENGOTW MACDFDT 04mar2025:10:17:56 MDYAMPM 3/4/2025 10:17 AM NLDATM 04Mar2025:10:17:56 NLDATMAP March 4, 2025 10:17:56 AM NLDATMDT March 4, 2025 NLDATML March 4, 2025 10:17:56 AM NLDATMM Mar 4, 2025 10:17:56 AM NLDATMMD March 04 NLDATMMDL March 04 NLDATMMDM Mar 04 NLDATMMDS 03/04 NLDATMMN March NLDATMS 03/04/2025 10:17:56 NLDATMTM 10:17:56 NLDATMTZ 10:17:56 -0500 NLDATMW Tuesday, March 4, 2025 10:17:56 AM NLDATMWN Tuesday NLDATMWZ Tuesday, March 4, 2025 10:17:56 AM -0500 NLDATMYM March 2025 NLDATMYML March 2025 NLDATMYMM Mar 2025 NLDATMYMS 03/2025 NLDATMYQ 1st quarter 2025 NLDATMYQL 1st quarter 2025 NLDATMYQM Q1 2025 NLDATMYQS 2025/1 NLDATMYR 2025 NLDATMYW week 09 2025 NLDATMZ 04Mar2025:10:17:56 -0500 NLDDFDT 04mrt2025:10:17:56 NORDFDT 04mar2025:10:17:56 POLDFDT 04mar2025:10:17:56 PTGDFDT 04mar2025:10:17:56 RUSDFDT 04???2025:10:17:56 SLODFDT 04mar2025:10:17:56 SVEDFDT 04mar2025:10:17:56 TWMDY 10:17 Tuesday, March 4, 2025 UNXEPOCH 1741083476
Likely it is the DATESTYLE system option value that is different between your two environments.
https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/nlsref/n0cmg3tjkn6zmbn1od6pna244zm7.htm
Regards,
Bill
Can you post the code you use to create the .csv?
Can you run PROC CONTENTS on the M7 dataset and the M8 dataset to see if they have different formats attached to your date-time variables?
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.