<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to winsorize variables in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254710#M13443</link>
    <description>&lt;P&gt;To the OP: Why are you wanting to Winsorize the data? What problem are you trying to solve?&lt;/P&gt;</description>
    <pubDate>Sat, 05 Mar 2016 12:40:06 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2016-03-05T12:40:06Z</dc:date>
    <item>
      <title>How to winsorize variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254655#M13433</link>
      <description>&lt;P&gt;I am trying to use code I found in&amp;nbsp;an &lt;A href="https://communities.sas.com/t5/SAS-Procedures/how-to-winsorize-variable-using-SAS/m-p/94199#M26671" target="_self"&gt;old&amp;nbsp;thread&lt;/A&gt; to winsorize variables. This code runs w/o error, but the means for the winsorized vars (wvar) are no different than the unwinsorized vars.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are a few things I don't understand (Questions also embedded in the syntax).&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;What is _n_? What role is it playing?&lt;/LI&gt;
&lt;LI&gt;Are these the winsorized variables (i.e. wvar1 &amp;nbsp;wvar2 &amp;nbsp;wvar3)?
&lt;OL&gt;
&lt;LI&gt;If so, the means are no different than the means of the variables prior to the "winsorization"&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;LI&gt;How would I interpret this "min(max(val{_V},wlo{_V}),whi{_V});"?&amp;nbsp;I'm confused by all these embedded arrays. I'm a relative beginner w/ SAS. &amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Are these the "min" and "max" functions here? What is the purpose of including them here?&lt;/LI&gt;
&lt;/OL&gt;
&lt;PRE&gt;proc univariate data=have noprint;
   var var1 var2 var3;
   output out=_testing  pctlpts=10 90  pctlpre=__var1 __var2 __var3;
run;

data want;
  set have;
  if _n_=1 then set _testing ;
* What is _n_? What role is it playing here?; 
 
 array wlo  {*} __ var1_10  __var2_10 __var2_10;
 array whi  {*} __ var1_90  __var2_90 __var2_90;  
 array wval {*} wvar1  wvar2  wvar3;
* Are these the variables that are supposed to contain the winsorized means?&lt;BR /&gt;
 array val   {*} var1 var2 var3;
  
  do _V=1 to dim(val);
     wval{_V}=min(max(val{_V},wlo{_V}),whi{_V});&lt;BR /&gt;  * Any help interpreting this?&lt;BR /&gt;  * Are these the "min" and "max" functions here? What is the purpose of including them here?
  end;
run;
&lt;/PRE&gt;
&lt;P&gt;Thank you very much for all your continued support. It is greatly appreciated. I would be lost w/o this forum.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2016 00:21:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254655#M13433</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2016-03-05T00:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to winsorize variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254663#M13436</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36911"&gt;@_maldini_﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In &lt;A href="https://communities.sas.com/t5/General-SAS-Programming/Winsorize-macro/m-p/254557" target="_blank"&gt;this brand new thread&lt;/A&gt; I've just pointed out that calculating Winsorized means "manually" (i.e. in a data step, possibly using a macro) can lead to different results than using &lt;A href="http://support.sas.com/documentation/cdl/en/syntaxidx/68719/HTML/default/index.htm#/documentation/cdl//en/procstat/68142/HTML/default/procstat_univariate_syntax01.htm#procstat.univariate.a0000000112" target="_blank"&gt;PROC UNIVARIATE&lt;/A&gt;'s WINSORIZED= option. I think this option was introduced only in SAS 9 [EDIT: no, I was wrong, sorry, it was introduced in SAS version 7], so that programs and macros for manual calculation might be obsolete, unless you need the Winsorized &lt;EM&gt;data&lt;/EM&gt; (not only the means) or you insist on using a different algorithm.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can take a closer look at your program tomorrow (CET) if you still want to use it.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2016 20:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254663#M13436</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-03-05T20:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to winsorize variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254667#M13439</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh﻿&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;unless you...you insist on using a different algorithm&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I certainly do not. I am looking for the easiest solution to this problem. I've never used a macro in SAS however...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2016 01:48:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254667#M13439</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2016-03-05T01:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to winsorize variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254670#M13440</link>
      <description>&lt;P&gt;Check these :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/How-to-winsorize/m-p/214976/highlight/true#M52927" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/How-to-winsorize/m-p/214976/highlight/true#M52927&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2015/07/15/winsorize-data.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2015/07/15/winsorize-data.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2016 02:58:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254670#M13440</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-03-05T02:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to winsorize variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254671#M13441</link>
      <description>&lt;P&gt;I highly recommend reading through the first link&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp﻿&lt;/a&gt;&amp;nbsp;posted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2016 03:03:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254671#M13441</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-05T03:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to winsorize variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254709#M13442</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh﻿&lt;/a&gt;&amp;nbsp;Thank you for acknowledging that a naive Winsorization, especially in the presence of missing values or repeated values, &amp;nbsp;can lead to wrong answers.&amp;nbsp; I have mentioned this in other threads, but it tends to be overlooked.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe that&amp;nbsp;the correct way to Winsorize data is given in my article &lt;A href="http://blogs.sas.com/content/iml/2015/07/15/winsorize-data.html" target="_self"&gt;"How to Winsorize Data in SAS."&lt;/A&gt;&amp;nbsp;When testing "manual" methods, be sure to use a data set that has missing and repeated values, such as Sashelp.Heart.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2016 12:39:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254709#M13442</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-03-05T12:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to winsorize variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254710#M13443</link>
      <description>&lt;P&gt;To the OP: Why are you wanting to Winsorize the data? What problem are you trying to solve?&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2016 12:40:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-winsorize-variables/m-p/254710#M13443</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-03-05T12:40:06Z</dc:date>
    </item>
  </channel>
</rss>

