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!
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;
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;
Hi SASJedi,
it looks like it worked! Thanks a lot for your superswift reply 🙂
Best,
Nerlo
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.
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.
Ready to level-up your skills? Choose your own adventure.