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

Hi All, I want to use no print option when data size is large .Please help me on the below.

Below is my sample code, if my data output exceeds 1000 observation then it should not print the output.

 

data xyz;
set sashelp.class;
run;

 

proc print data=xyz;
run;


proc report data=xyz (option=noprint);

run;

 

proc sql ;
select * from sashelp.class;
run;

 

Thanks,

Siva

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

I don't understand the request.

Do you want to only print a few observations to provide an example?

proc print data=xyz(obs=10);
title2 'First 10 observations';
run;

View solution in original post

5 REPLIES 5
Tom
Super User Tom
Super User

I don't understand the request.

Do you want to only print a few observations to provide an example?

proc print data=xyz(obs=10);
title2 'First 10 observations';
run;
sivastat08
Pyrite | Level 9

Thanks for answer Tom.

 

Reeza
Super User
Not sure what you mean. You want to conditionally execute the PROC PRINT or REPORT?

Do you want to limit the observations or not have any output.

You can add the data set option OBS=1000 to the data sets to have it only print 1000 max.

proc print data=xyz (obs=1000);
run;


sivastat08
Pyrite | Level 9

Thanks for the replay Reeza.

 

if My data exceeds 1000 then it shout not print otherwise it should print .

 

your code is working fine.Thanks for the answer Reeza

Reeza
Super User

1. Get the number of observations in the data set.

2. Decide to print or not.

 

proc sql noprint;
create table xyz as
select * from sashelp.class;
quit;

*gets count;
%let count = &sqlobs;

data _null_;
if &count <= 1000 then do;
      call execute('proc print data=xyz; run;');
end;

run;

There are various ways to get the count and various ways to conditionally run things, I've illustrated one above. I'm assuming your code is not realistic and simplified for the forum so just giving the generic solution.

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 7381 views
  • 1 like
  • 3 in conversation