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?
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.
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.
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).
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.