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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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