BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Nerlo
Calcite | Level 5

Hello to the SAS Community!

 

I really need your help, because I am a bit stuck with a little problem. I apologize if the question is perhaps bit dumb, but I am still in the early phases of my SAS learning process 🙂

 

I am using PROC SURVEYMEANS to calculate geometric mean and geometric std. The step with this procedure belongs to a bigger macro, which calculates several statistics and which is supposed to produce - at the end - only the final table, without showing any other window. I have already suppressed all the other outputs to the results window from the other various procedures that the macro uses (for example, PROC MEANS, or PROC SQL) by simply using the noprint option for each one of them. Unfortunately I was not able to do it for PROC SURVEYMEANS and I don't really know how to solve my problem. 

 

Can somebody help me with that? 

 

Thanks in advance to all of you!

1 ACCEPTED SOLUTION

Accepted Solutions
SASJedi
SAS Super FREQ

You can use the ODS SELECT statement to suppress and restore output. Example:

data IceCream;
   input Grade Spending @@;
   if Grade=7 then Prob=20/1824;
   if Grade=8 then Prob=9/1025;
   if Grade=9 then Prob=11/1151;
   Weight=1/Prob;
   datalines;
7 7  7  7  8  .  9 10  7  .  7 10  7  3  8 20  8 19  7 2
7 .  9 15  8 16  7  6  7  6  7  6  9 15  8 17  8 14  9 .
9 8  9  7  7  3  7 12  7  4  9 14  8 18  9  9  7  2  7 1
7 4  7 11  9  8  8  .  8 13  7  .  9  .  9 11  7  2  7 9
;

data StudentTotals;
   input Grade _total_;
   datalines;
7 1824
8 1025
9 1151
;

ods select none;
title 'Analysis of Ice Cream Spending';
proc surveymeans data=IceCream total=StudentTotals nomcar mean sum;
   strata Grade;
   var Spending;
   weight Weight;
run;

ods select all;
proc print data=StudentTotals;
run;
Check out my Jedi SAS Tricks for SAS Users

View solution in original post

2 REPLIES 2
SASJedi
SAS Super FREQ

You can use the ODS SELECT statement to suppress and restore output. Example:

data IceCream;
   input Grade Spending @@;
   if Grade=7 then Prob=20/1824;
   if Grade=8 then Prob=9/1025;
   if Grade=9 then Prob=11/1151;
   Weight=1/Prob;
   datalines;
7 7  7  7  8  .  9 10  7  .  7 10  7  3  8 20  8 19  7 2
7 .  9 15  8 16  7  6  7  6  7  6  9 15  8 17  8 14  9 .
9 8  9  7  7  3  7 12  7  4  9 14  8 18  9  9  7  2  7 1
7 4  7 11  9  8  8  .  8 13  7  .  9  .  9 11  7  2  7 9
;

data StudentTotals;
   input Grade _total_;
   datalines;
7 1824
8 1025
9 1151
;

ods select none;
title 'Analysis of Ice Cream Spending';
proc surveymeans data=IceCream total=StudentTotals nomcar mean sum;
   strata Grade;
   var Spending;
   weight Weight;
run;

ods select all;
proc print data=StudentTotals;
run;
Check out my Jedi SAS Tricks for SAS Users
Nerlo
Calcite | Level 5

Hi SASJedi, 

 

it looks like it worked! Thanks a lot for your superswift reply 🙂

 

Best, 

Nerlo

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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