BookmarkSubscribeRSS Feed
DPraba79
Calcite | Level 5
Hi All,

I have a situation like, i have to create a excel book with 2 sheet on it (Multi Tab) in unix. Example: I have a two data sets say, data set A & Dataset B. I have to put these datasets in to two sheets (sheet1 & sheet2) in a excel work book by using Unix-SAS .

Thanks in Advance!!!
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
You have 2 basic choices for creating multi-tab/multi-sheet workbooks:
1) PROC EXPORT (need SAS/Access to PC File Formats) or
2) ODS TAGSETS.EXCELXP

Both of these topics have appeared in previous forum postings. Since you posted in the ODS forum, however, I assume that you are interested in an ODS approach. Some starter code is shown below. That will get you started. There are many, many postings about ODS TAGSETS.EXCELXP in the forum and many user-group papers that you can find by searching on Google.

After the MULTI_SHEET.XML file has been created, you will want to FTP it from Unix to Windows so you can open the file with Excel. The file contains Excel 2003 Spreadsheet Markup Language XML and can only be opened with Excel 2003 or higher.

cynthia
[pre]
ods tagsets.excelxp file='multi_sheet.xml';

proc print data=sashelp.class;
run;

proc print data=sashelp.shoes(obs=50);
var region product sales;
run;

ods _all_ close;
[/pre]
DPraba79
Calcite | Level 5
Thanks Cythia... But when try this method.. I got only one tabl(sheet) comes out with below code (two prins)
data data1;
a=10;
run;
data data2;
b=10;
run;


ods tagsets.excelxp file='/home/testsas/tst.xml';


proc print data=data1;

proc print data=data2;

ods _all_ close; Message was edited by: DPraba79
Cynthia_sas
SAS Super FREQ
Hi:

1) Are there any LOG messages, such as
[pre]
WARNING: Tagset TAGSETS.EXCELXP not found; the default tagset
will be used instead.
[/pre]

If you see this message, what version of SAS are you running?

2) In my code (and anytime you use ODS), the RUN; statements make a difference. ODS _ALL_ CLOSE is not a step boundary. So the last PROC PRINT would not execute until AFTER the ODS file was closed. Compare my code to your code, as far as RUN statements. I have a RUN at the end of EVERY PROC PRINT step and BEFORE ODS _ALL_ CLOSE;

If you run my code, EXACTLY as I have coded it (which you should be able to do because the code uses SASHELP files), what are the results??

cynthia
Ksharp
Super User
Just as Cynthia said that your UNIX-SAS has not this tagsets.excelxp.
You can use another approach that Cynthia mentioned before.

[pre]
proc export data=sashelp.shoes outfile="c:\temp\op.xls" dbms=xls replace;
sheet='one';
run;

proc export data=sashelp.class outfile="c:\temp\op.xls" dbms=xls replace;
sheet='two';
run;
[/pre]



Ksharp

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
  • 4 replies
  • 2279 views
  • 0 likes
  • 3 in conversation