BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

I want to print 3 tables  side by side in one excel sheet.

When I run my code 3 different excel sheets are created but I want to have only one sheet.

 

 

ods path work.temptemp(update) sasuser.templat(update)
sashelp.tmplmst(read);
ods path show;
ods tagsets.excelxp file="/usr/local/SAS/MidulOld/UserDir/Example.xls"
style=htmlblue;

 

ods tagsets.excelxp options(embedded_titles='yes'
sheet_interval='none' sheet_name='tables'
absolute_column_width="12,13");
Title;
proc print data=a1 noobs label;
Run;
Data a1;
input x y;
cards;
1 10
2 20
3 30
;
Run;

ods tagsets.excelxp options(embedded_titles='yes'
sheet_interval='none' sheet_name='tables'
absolute_column_width="12,13");
Title;
proc print data=a1 noobs label;
Run;
Data a2;
input x y;
cards;
4 10
5 20
6 30
;
Run;

ods tagsets.excelxp options(embedded_titles='yes'
sheet_interval='none' sheet_name='tables'
absolute_column_width="12,13");
Title;
proc print data=a1 noobs label;
Run;
Data a3;
input x y;
cards;
7 10
8 20
9 30
;
Run;

 

 

 

3 REPLIES 3
Ronein
Onyx | Level 15

Hello

I want to export  3 tables  to one excel file with one sheet only where tables are  side by side .

When I run my code 3 different excel sheets are created but I want to have only one sheet.

 

 

ods path work.temptemp(update) sasuser.templat(update)
sashelp.tmplmst(read);
ods path show;
ods tagsets.excelxp file="/usr/local/SAS/MidulOld/UserDir/Example.xls"
style=htmlblue;

 

ods tagsets.excelxp options(embedded_titles='yes'
sheet_interval='none' sheet_name='tables'
absolute_column_width="12,13");
Title;
proc print data=a1 noobs label;
Run;
Data a1;
input x y;
cards;
1 10
2 20
3 30
;
Run;

ods tagsets.excelxp options(embedded_titles='yes'
sheet_interval='none' sheet_name='tables'
absolute_column_width="12,13");
Title;
proc print data=a1 noobs label;
Run;
Data a2;
input x y;
cards;
4 10
5 20
6 30
;
Run;

ods tagsets.excelxp options(embedded_titles='yes'
sheet_interval='none' sheet_name='tables'
absolute_column_width="12,13");
Title;
proc print data=a1 noobs label;
Run;
Data a3;
input x y;
cards;
7 10
8 20
9 30
;
Run;

 

 

 

Reeza
Super User

ODS TAGSETS does not support tables side by side. 

 

You can use ODS MSOFFICE_2K as suggested by @Ksharp or you can use a PROC EXPORT to a specific range that you can pre-calculate. 

 

 

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2948 views
  • 0 likes
  • 3 in conversation