Programming the statistical procedures from SAS

winsorized mean

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 82
Accepted Solution

winsorized mean

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


Accepted Solutions
Solution
‎08-11-2011 01:05 PM
Super User
Posts: 18,569

winsorized mean

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


All Replies
SAS Super FREQ
Posts: 3,547

winsorized mean

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.)

Solution
‎08-11-2011 01:05 PM
Super User
Posts: 18,569

winsorized mean

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 ;

Frequent Contributor
Posts: 82

winsorized mean

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

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

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