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).
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.