BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ronein
Meteorite | Level 14

Hello

I am using ods tagsets.ExcelXP   to export one table to one XLS file.

I see that after I run it there is print  on my screen in "Results-SAS Report" window.

How can I prevent the print?

The reason is that if the table is very big then it might cause problem to print on screen such a big table.

I only want to export it without print it.

I know that proc export just export it without print it but I also want to know how to do it via ods tagsets.ExcelXP.

 

%macro ExportOneTbl(ds,path,FileName);
ods listing close;
ods tagsets.ExcelXP  
file= "&FileName"  
path= &path;
proc print data=&ds  noobs; 
run; ods tagsets.ExcelXP close; 
ods listing;
%mend ExportOneTbl;


%ExportOneTbl(ds=sashelp.cars,                     
              path="/My path/",
              FileName=cars1.xls);

/*Ask:How to prevent print on screen*/
/*Ask:How to control sheet name?*/
/*Ask:Here we export to xls file. Can we also export to csv/xlsx/xml files*/
/*Is it better to use proc export or  ods tagsets.ExcelXP ? */
/*Can we control formats  with ods tagsets.ExcelXP ?*/
1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

Which client is used? Enterprise Guide? SAS Studio? In Enterprise Guide, you can deactivate the default output of programs via their properties. Or try

 

ods _all_ close;

or

 

ods <destination_name> exclude  all;

before you proc print. And afterwards

 

ods <destination_name> exclude none;

The destination name depends on the client you are using. You can query sashelp.vdest to get the names of the open destinations:

 

proc print data=sashelp.vdest;
run;

You could also create a dynamic exclude by querying the view and creating exclude statements.

 

View solution in original post

3 REPLIES 3
andreas_lds
Jade | Level 19

Which client is used? Enterprise Guide? SAS Studio? In Enterprise Guide, you can deactivate the default output of programs via their properties. Or try

 

ods _all_ close;

or

 

ods <destination_name> exclude  all;

before you proc print. And afterwards

 

ods <destination_name> exclude none;

The destination name depends on the client you are using. You can query sashelp.vdest to get the names of the open destinations:

 

proc print data=sashelp.vdest;
run;

You could also create a dynamic exclude by querying the view and creating exclude statements.

 

Ronein
Meteorite | Level 14

Great .

ods _all_ close worked well.

There is still window called "Results-SAS report" but the print includes no data.

 

%macro ExportOneTbl(ds,path,FileName);
ods _all_ close;/*To prevent print on screen*/
ods listing close;
ods tagsets.ExcelXP  
file= "&FileName"  
path= &path;
proc print data=&ds  noobs; 
run; 
ods tagsets.ExcelXP close; 
ods listing;
%mend ExportOneTbl;
%ExportOneTbl(ds=sashelp.cars,
              path="/my path/",
              FileName=cars1.xls);

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 463 views
  • 1 like
  • 3 in conversation