DATA Step, Macro, Functions and more

winsorise data using standard deviation

Reply
Contributor
Posts: 66

winsorise data using standard deviation

How do we winsorize variables using standard deviation instead of percentiles in SAS? Let's say we want to winsorise VarX at 3.5 standard deviations?How do we do that in SAS?

 

Super User
Posts: 10,787

Re: winsorise data using standard deviation

PROC MEANS can easily get MEAN and STD.

After that , [ mean-3.5*std , mean+3.5*std ] is the range you need, and next thing you can do by data step is very easy.

 

Contributor
Posts: 66

Re: winsorise data using standard deviation

Hi,

Can you please write the code that I can use, as I am unsure on how to do it.
Trusted Advisor
Posts: 1,256

Re: winsorise data using standard deviation

I strongly recommend you to read Rick Wicklin's 2017 blog article "Winsorization: The good, the bad, and the ugly" before you start modifying your data. This article contains a link to another one (from 2015) in Rick's blog which is titled "How to Winsorize data in SAS", but it also points out that Winsorization can be inappropriate, especially when done improperly.

Esteemed Advisor
Posts: 5,541

Re: winsorise data using standard deviation

Trimmed and Winsorized statistics require the removal or replacement of an equal number of observations at both ends of the variable range. Doing otherwise will bias location estimates.These statistics have been greatly improved on by more modern robust measures.

 

If you suspect your data of containing outliers, you should rely on robust location and scale estimates such as the median (location) and Qn (scale).

PG
Ask a Question
Discussion stats
  • 4 replies
  • 99 views
  • 2 likes
  • 4 in conversation