data have;
input ID DATE DATE9. TIME TIME.;
format date date9.;
format time hhmm.;
datalines;
12 31dec2018 12:10:02
12 11dec2018 12:11:02
;
run;
PROC EXPORT Outfile= "\\Shared\DPMS\have.xls"
DATA= have
/*label /*replace with label name*/
DBMS= EXCELCS REPLACE;
SHEET='DATA';
SERVER='saspcff';
ID DATE TIME
12 12/31/2018 1/0/1900
12 12/11/2018 1/0/1900
As you can see the TIME exports as 1/0/1900. Is there a way to preserve the actual time as a time format. The report will e dumped into another program thus the formats must remain. In this case I want the time to retain as 10:12 and 11:12
if you use datetime32. for the format will it work
data have;
input ID DATE DATE9. TIME TIME.;
format date datetime32.;
format time hhmm.;
datalines;
12 31dec2018 12:10:02
12 11dec2018 12:11:02
;
run;
Turn it into CHARACTER variable ?
Do you have to use EXCELCS engine? Do you really need to create the old (really old) XLS format?
Why not just let SAS write the file directly using the XLSX engine?
PROC EXPORT Outfile= "c:\downloads\have.xlsx" dbms=xlsx replace
data=have
;
run;
based on the userid I would say that they are dealing with old version of Excel along with the newer versions.
anyway it should not mater to a good programmer if the requested results are to be in versions of xls, xlsx, csv, txt or even if the file has NDX or AD1 on the end. Data is data, and the process of providing the results are part of the business requirements gathering for the project or task that is to be preformed. Most of the time we as the data results providers need to confirm that the managers, departments or groups that may be backing the request understand what they are asking for. Most of the time they are just picking at the tip of the iceberg.
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.