Statistical Procedures

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

Hi,

I want to calculate winsorized means for quite many (several thousands) of class variables and later use these results in other procedures so I need to get them in data set.

With the following code it works fine for small number of class variables, but if there are many, log and listing just gets too crowded.

ods trace on ;

ods output winsorizedmeans=means (keep= classvar mean rename=mean=winsorized_mean) ;

proc univariate winsorized = 0.10 data=mydata;

class classvar;

var var1 ;

run ;

ods trace off ;

Could anyone please suggest me what to do? I know how to change so that there is no listing output, but that doesn't solve huge log problem.

Maybe I'm just doing it in too complicated way and there is easier way to get winsorized mean values?

Thank you,

Ieva

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

You don't need ods trace on to run, unless you need it for some other reason. I'm guessing thats what's filling your log.

Google proc printto to see how to redirect your log to a file.

Try the following though, it should create the dataset with minimal output.

ods select none;

proc univariate winsorized = 0.10 data=mydata;

class classvar;

var  ;

ods output winsorizedmeans=means (keep= classvar mean rename=mean=winsorized_mean) ;

run ;

View solution in original post

3 REPLIES 3
Rick_SAS
SAS Super FREQ

Do you have this in a macro loop. Otherwise, I don't see how you could be filling up the log. Maybe the Forum software "ate" some of your code? I am also seeing an empty VAR statement, which doesn't look right.

Without the code to guide me, try this:

%macro ODSOff();
   ods graphics off;
   ods <dest> exclude all;
   ods noresults;
%mend;

%macro ODSOn();
   ods results;
   ods <dest> exclude none;
   ods graphics on;
%mend;

Replace <dest> with whatever destingation you are using (sounds like LISTING.)

Before the UNIVARIATE code, use %ODSOff, and after the proc call use %ODSOn.

(Of course, you also want ODS TRACE OFF.)

Reeza
Super User

You don't need ods trace on to run, unless you need it for some other reason. I'm guessing thats what's filling your log.

Google proc printto to see how to redirect your log to a file.

Try the following though, it should create the dataset with minimal output.

ods select none;

proc univariate winsorized = 0.10 data=mydata;

class classvar;

var  ;

ods output winsorizedmeans=means (keep= classvar mean rename=mean=winsorized_mean) ;

run ;

ieva
Pyrite | Level 9

Thank you Rick and Reeza for fast and useful answers! Now everything is working just great! Smiley Happy

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 3267 views
  • 3 likes
  • 3 in conversation