Help using Base SAS procedures

Proc Export

Accepted Solution Solved
Reply
Super Contributor
Posts: 1,040
Accepted Solution

Proc Export


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


Accepted Solutions
Solution
‎07-26-2013 01:18 PM
Super Contributor
Posts: 543

Re: Proc Export

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


All Replies
Super Contributor
Posts: 543

Re: Proc Export

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.

Super Contributor
Posts: 1,040

Re: Proc Export

Hi ,

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

Thanks

Solution
‎07-26-2013 01:18 PM
Super Contributor
Posts: 543

Re: Proc Export

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

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

Smiley Happy

Super Contributor
Posts: 339

Re: Proc Export

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

Super Contributor
Posts: 1,040

Re: Proc Export

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

Super Contributor
Posts: 543

Re: Proc Export

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.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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