BookmarkSubscribeRSS Feed
SASMom2
Fluorite | Level 6

I have a code that creates 3,000 individual excel reports through ODS Tagsets in SAS. Some of them are created even if there is not data in the source dataset. So, when you open the excel report there is no data in it.

I do not want to create the excel report if there is no data in the dataset.

How do I program that?

I tired to copy my table but for some reason I could not do it so I do not have any table to show you.

 

Thanks in advance.

 

 

 

  

2 REPLIES 2
Tom
Super User Tom
Super User

Most report steps don't make any output when the input data is empty so seeing HOW you are making the report is important.

 

I don't think the table (if by table you mean the report you are producing) matters that much.  The code is more important.  And to understand the code it might help to show some sample of the DATASET(s).  To show data just post a simple data step that recreates the data. That way the type/length and any formats attached to the variables are clear.  Make sure to use the Insert SAS Code button to get a pop-up window to paste/type/edit your code so that formatting is preserved.

 

 

SASMom2
Fluorite | Level 6

Tom, thanks for your reply. I was able to resolve it by doing below.

 

proc sql noprint;
select count(*) into :nobs 
from test 
where custrun  =  "&custrun.";
quit;

%if &nobs = 0 %then %do;

%goto exitgoto;
%end;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 314 views
  • 0 likes
  • 2 in conversation