BookmarkSubscribeRSS Feed
nannà
Calcite | Level 5

Hi,

I am unable to export the report from Guide to excel,

do you have any suggestions?

7 REPLIES 7
RMP
SAS Employee RMP
SAS Employee

a little more information would be helpful 🙂

nannà
Calcite | Level 5

I use summary table task for create a report;

I want generate the report in xls estension so i insert the code:

ODS

tagsets.msoffice2k file="..."

Proc tabulate........(Guide's code)

ODS

tagsets.msoffice2k close;

but the result is a report with html extension;

;

art297
Opal | Level 21

I think the file will open as an Excel file if you set the file's extension to be .xls.

However, depending upon which version of Excel you have, you may want to take a look at: http://support.sas.com/kb/31/956.html

ct
Calcite | Level 5 ct
Calcite | Level 5

If you are using the summary table task, you can just check the box for "Save results to a dataset" on the Results menu.  Then, run the report.  You should see the html file and also a dataset.  Open the dataset and select Microsoft Excel under the Send To menu.

Hima
Obsidian | Level 7

Say that the data set you used to create html report is Table_A. Run the below code, instead of converting the html report to excel.

PROC EXPORT DATA= Table_A

            OUTFILE= "C:\Documents and Settings\Test.xls"

            DBMS=EXCEL REPLACE;

     SHEET="Sheet_1";

RUN;

art297
Opal | Level 21

Hima: yes, if the OP has SAS Access for pcfiles and doesn't like the appearance of the original.

Cynthia_sas
SAS Super FREQ

Hi:

  Look at the explanation and the code snippet at this previous posting:

http://communities.sas.com/message/8719#8719

LIBNAME engine and PROC EXPORT and PCFILES methods create "data-to-data" export without any colors, fonts or formatting control over cell widths, titles, etc. If you want that "plain" look and feel, then use these true export methods.

  ODS methods re not "true" export methods. ODS uses a markup language method of creating output files that Excel can open and render -- ODS methods work because they create ASCII text files (CSV, HTML or XML) that are compliant with Microsoft Office standards. Try the code snippet in the above posting. The only hitch is that inside EG, when you are submitting code with your own ODS statements, you have to turn off the EG automatic creation of output so either

1) go to Tools--> Options --> Results and uncheck ALL the result types (no check next to SASReport, HTML, RTF, etc)

OR

2) use

ODS _ALL_ CLOSE;

BEFORE any of your own code in the EG code editor window. This statement will close anything that EG automatically tries to open and create. The down side of this approach is that you might get a blank SASReport Result tab or a blank HTML Result tab, depending on what you have checked under Results to automatically generate. And, then you will get a separate Result tab for the output created by your ODS statements.

  As the above posting explains, the file extension that you use (.HTML, .XML, versus .XLS) is merely a convenient way to "fool the Windows registry" into launching Excel when you double click on the file name. Normally, a .HTML file will launch a browser, for example -- well, if you use ODS MSOFFICE2K, you don't want to launch a browser for the file, you want to launch Excel. So you either name the file .HTML and go outside of EG to Excel and do a File --> Open of the HTML file from inside Excel, or you "fool" the Windows registry by naming the file .XLS -- your choice.

  The key is that from inside EG, you have the added complication of EG trying to add ODS statements to your code based on your choices under
Tools --> Options (hence the need for you to adjust using #1 or #2 as explained above).

  

cynthia

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 7 replies
  • 1400 views
  • 3 likes
  • 6 in conversation