BookmarkSubscribeRSS Feed
Shantaram
Calcite | Level 5

Hi,

 

Its possible to add more then two tables in none excel sheet (xlsx format).

Eg. I have 2 tables and need to display in one excel sheet. it's possible or not. If possible then how?.

 

 

8 REPLIES 8
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Yes it is possible.  In pre 9.4 days, and probably still, the best method is ods tagsets.excelxp + proc report:

https://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html

This doesn't create a native Excel file, but an XML file that Excel can read and interpret, but gives great flexibility and formatting.

 

Then there is libname excel - which is newer (9.4), and creates native files.  It didn't seem as flexibile or useful to me though at the moment:

http://www2.sas.com/proceedings/sugi31/024-31.pdf

 

There are other methods, but I would go with the above first.  Proc export tends to be a best guess, DDE is far to old to be used etc.

LinusH
Tourmaline | Level 20

Another option would be to use Add-in for MS Office, where the Excel report pulls data from SAS. And you can design your Excel report exactly the way you wish.

Data never sleeps
Reeza
Super User

In SAS 9.4 there's also ODS Excel, similar to ODS tagsets which does generate a native excel file. 

 

Proc of export and XLSX will also support multiple sheets in SAS 9.4+ 

Shantaram
Calcite | Level 5

Hi,

please find attachment for more details.

table one # New Appointments fixed 

teble two # Meetings scheduled (due).

i want both in same sheet.


test.jpg
LinusH
Tourmaline | Level 20

@Shantaram, you've had already received some input.

So the next step is that you explore those options - and then return with any relevant follow-up questions if necessary.

Data never sleeps
Shantaram
Calcite | Level 5

Hi Linush,

 

I got your point but i want output in one page not in two diffrent pages.

Reeza
Super User

ODS tagsets.excelxp file='sample.xml' options(sheet_interval=none);

 

proc print data=sashelp.class;

 

proc print data=sashelp.air;

run;

 

ods tagsets.excelxp close;

 

Change the file destination to somewhere that makes sense for you and open the resulting file in Excel. 

BrunoMueller
SAS Super FREQ

Hi

 

check out the ODS EXCEL destination

 

code will look similar to

 

ods excel file="c:\temp\sample.xlsx" options(SHEET_INTERVAL=  'NONE');

proc print data=sashelp.class;
  where sex = "F";
run;

proc print data=sashelp.class;
  where sex = "F";
run;

ods excel close;

Bruno

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!

How to Concatenate Values

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.

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
  • 8 replies
  • 1327 views
  • 0 likes
  • 5 in conversation