BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
robertrao
Quartz | Level 8


Hi,

While I export I want the datetime to appear as it is in the dataset. But I get only the dates but the formulae bar shows the datatime..

How can I get it inside of the cells??

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
AncaTilea
Pyrite | Level 9

I believe so, but you need to have something like this:

ods tagsets.excelxp options(sheet_label = "&sheet_Name" );

Smiley Happy

View solution in original post

6 REPLIES 6
AncaTilea
Pyrite | Level 9

Hi.

You may want to try ods tagsets.excelxp instead of proc export.

So, you could do something like this:

ods tagsets.excelxp file = "....\my_file.xls";

     proc print data = your_data;run;

ods tagsets.excelxp close;

Good luck.

Anca.

robertrao
Quartz | Level 8

Hi ,

If I use tagsets can I also export different datasets to the same Excel sheet??

Thanks

AncaTilea
Pyrite | Level 9

I believe so, but you need to have something like this:

ods tagsets.excelxp options(sheet_label = "&sheet_Name" );

Smiley Happy

Vince28_Statcan
Quartz | Level 8

Could you provide your  export code segment with an example of a cell/formulae cell/dataset record triplet?

robertrao
Quartz | Level 8

Hi ,

Please find the code

%macro export(dsname,sheet_Name);

proc export data=&dsname

outfile="location\data.xls"

dbms=excel replace;

sheet=&sheet_Name;

run;

%mend;

Regards

AncaTilea
Pyrite | Level 9

Sorry, I had to figure out how to use the options(sheet_label...);

So here is something that could work:

%macro export();

  ods tagsets.excelxp file = "&file_path.\my_file.xls" ;

     %do i = 1 %to 4;

       ods tagsets.excelxp options(sheet_label = "sheet_Name_&i" ); ;

          proc print data = &dsname.;run;

     %end;

  ods _all_ close;

%mend;

%export();         

So, you first initialize (or whatever the word is) the ODS TAGSETS.EXCELXP file=....

Then you use another ODS TAGSETS.EXCELXP OPTIONS(sheet_label...) for each of your export...


I hope this helps.

Anca.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1761 views
  • 3 likes
  • 3 in conversation