<?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: winsorized mean and proc univariate ods in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272690#M14359</link>
    <description>&lt;P&gt;Is HALFP not contained in the ODS output datasets of your PROC UNIVARIATE step? With my SAS 9.4 it is created by default.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically, for&amp;nbsp;&lt;SPAN&gt;Winsorized and trimmed means you specify a number &lt;EM&gt;k&lt;/EM&gt; of observations to be Winsorized (or trimmed, respectively) at the high and the low end of the empirical distribution. &lt;/SPAN&gt;When you request a Winsorized (or trimmed) mean by specifying a percentage &lt;EM&gt;p&lt;/EM&gt; such as 0.1 (i.e.&amp;nbsp;10%), &lt;EM&gt;k&lt;/EM&gt; "&lt;SPAN&gt;is equal to the smallest integer that is greater than or equal to &lt;EM&gt;np&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN&gt;, where &lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN class=" AAmathtext"&gt;n&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN&gt; is the number of observations" (&lt;A href="http://support.sas.com/documentation/cdl//en/procstat/68142/HTML/default/viewer.htm#procstat_univariate_syntax01.htm" target="_blank"&gt;documentation&lt;/A&gt;), i.e. it's rounded up to the next integer.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The actual percentage of Winsorized (trimmed) observations is 2&lt;EM&gt;k&lt;/EM&gt;/&lt;EM&gt;n&lt;/EM&gt;. (&lt;EM&gt;k&lt;/EM&gt;/&lt;EM&gt;n&lt;/EM&gt; for the high end plus &lt;EM&gt;k&lt;/EM&gt;/&lt;EM&gt;n&lt;/EM&gt; for the low end.) Variable HALFP contains the value &lt;EM&gt;k&lt;/EM&gt;/&lt;EM&gt;n&lt;/EM&gt;&amp;nbsp;* 100 (hence the name), which is typically slightly larger than 100&lt;EM&gt;p&lt;/EM&gt; because of the rounding mentioned above. Please note that &lt;EM&gt;n&lt;/EM&gt; refers to the number of observations &lt;EM&gt;with non-missing values&lt;/EM&gt; of the analysis variable (in the respective BY group, if any), hence it can vary between analysis variables.&lt;/P&gt;</description>
    <pubDate>Tue, 24 May 2016 11:25:26 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2016-05-24T11:25:26Z</dc:date>
    <item>
      <title>winsorized mean and proc univariate ods</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/271667#M14293</link>
      <description>&lt;P&gt;Hi Folks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm running the below proc in order to create a unique dataset including for each provincia both the winsorized and trimmed mean ,for variable age and tenure, &amp;nbsp;with both 10% and %level&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I would expect a dataset result like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Province AgeWinsored10% AgeTrimmed10% AgeWinsored% &amp;nbsp;AgTrimmed5%&lt;/P&gt;&lt;P&gt;&amp;nbsp;ex. Barcelona &amp;nbsp;x1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x4&lt;/P&gt;&lt;P&gt;&amp;nbsp; Madrid ec...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code hower is not working how it should be&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any Idea about how I should correct the code ??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ods select none;
proc univariate winsor= 0.10 trim=0.1 winsor=0.05 trim=0.05 data=reduced;
var age tenure ;
by provincia;
ods output WinsorizedMeans=winsorizedmean10(keep=WinsorizedMean) TrimmedMeans=trimmedMean10 (keep=TrimmedMean) 
WinsorizedMeans=winsorizedmean5(keep=WinsorizedMean) TrimmedMeans=trimmedMean5 (keep=TrimmedMean) ;
run ;
ods trace off;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 10:05:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/271667#M14293</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2016-05-19T10:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: winsorized mean and proc univariate ods</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/271676#M14294</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/71355"&gt;@dcortell﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc univariate winsor=0.1 0.05 trim=0.1 0.05 data=reduced;
var age tenure;
by provincia;
ods output WinsorizedMeans = wmeans(keep=provincia varname halfp mean)
           TrimmedMeans    = tmeans(keep=provincia varname halfp mean);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The resulting datasets WMEANS and TMEANS will contain one observation per combination of&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;(formatted) value of PROVINCIA&lt;/LI&gt;
&lt;LI&gt;analysis variable (age, tenure)&lt;/LI&gt;
&lt;LI&gt;percentage (10, 5), to be identified using variable HALFP&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Variable MEAN will contain the&amp;nbsp;Winsorized or trimmed means, respectively.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: Feel free to use different names for the output datasets WMEANS and TMEANS.&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 11:09:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/271676#M14294</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-19T11:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: winsorized mean and proc univariate ods</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/271969#M14301</link>
      <description>&lt;P&gt;@FreelanceReinhard many thanks for the advice!! There is any way to combine the results of the wins and trims averages in a unique dataset instead that two separate ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thansk!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 13:08:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/271969#M14301</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2016-05-20T13:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: winsorized mean and proc univariate ods</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/271985#M14302</link>
      <description>@FreelanceReinhard many thanks for the advice!! There is any way to combine the results of the wins and trims averages in a unique dataset instead that two separate ? Thansk!! D</description>
      <pubDate>Fri, 20 May 2016 14:04:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/271985#M14302</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2016-05-20T14:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: winsorized mean and proc univariate ods</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/271991#M14303</link>
      <description>&lt;P&gt;I don't think this is possible directly in PROC UNIVARIATE, but, of course, you can combine the two datasets as you can combine any other datasets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example ("vertical" concatenation):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data allmeans;
set wmeans tmeans indsname=dsn;
length meantype $10;
if scan(dsn,2,'.')=:'W' then meantype='Winsorized';
else meantype='trimmed';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Alternatively, you could join the datasets ("horizontally") so as to have Winsorized and trimmed means as two distinct variables.&lt;/P&gt;
&lt;P&gt;Edit: Here's how:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table allmeans2 as
select a.provincia, a.varname, round(a.halfp, 2.5) as pct,
       a.mean as wmean label='Winsorized mean',
       b.mean as tmean label='Trimmed mean'
from wmeans a, tmeans b
where a.provincia=b.provincia &amp;amp; a.varname=b.varname
      &amp;amp; round(a.halfp, 2.5)=round(b.halfp, 2.5)
order by provincia, varname, pct;
quit;

proc print data=allmeans2 noobs label;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 May 2016 14:45:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/271991#M14303</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-20T14:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: winsorized mean and proc univariate ods</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272667#M14356</link>
      <description>&lt;P&gt;Hi FreelanceReinhard&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quick question. I was bronswing in the web for material &amp;nbsp;about &amp;nbsp;the " halfp " variable you have used to catch the trim and wins Respectively trimmered/winsored percentage but seems that this " halfp" variable is something not generated automatically in the trim and wins tables&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you be so gentle to explain where did you get it or share any material on that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 10:25:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272667#M14356</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2016-05-24T10:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: winsorized mean and proc univariate ods</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272690#M14359</link>
      <description>&lt;P&gt;Is HALFP not contained in the ODS output datasets of your PROC UNIVARIATE step? With my SAS 9.4 it is created by default.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically, for&amp;nbsp;&lt;SPAN&gt;Winsorized and trimmed means you specify a number &lt;EM&gt;k&lt;/EM&gt; of observations to be Winsorized (or trimmed, respectively) at the high and the low end of the empirical distribution. &lt;/SPAN&gt;When you request a Winsorized (or trimmed) mean by specifying a percentage &lt;EM&gt;p&lt;/EM&gt; such as 0.1 (i.e.&amp;nbsp;10%), &lt;EM&gt;k&lt;/EM&gt; "&lt;SPAN&gt;is equal to the smallest integer that is greater than or equal to &lt;EM&gt;np&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN&gt;, where &lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN class=" AAmathtext"&gt;n&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN&gt; is the number of observations" (&lt;A href="http://support.sas.com/documentation/cdl//en/procstat/68142/HTML/default/viewer.htm#procstat_univariate_syntax01.htm" target="_blank"&gt;documentation&lt;/A&gt;), i.e. it's rounded up to the next integer.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The actual percentage of Winsorized (trimmed) observations is 2&lt;EM&gt;k&lt;/EM&gt;/&lt;EM&gt;n&lt;/EM&gt;. (&lt;EM&gt;k&lt;/EM&gt;/&lt;EM&gt;n&lt;/EM&gt; for the high end plus &lt;EM&gt;k&lt;/EM&gt;/&lt;EM&gt;n&lt;/EM&gt; for the low end.) Variable HALFP contains the value &lt;EM&gt;k&lt;/EM&gt;/&lt;EM&gt;n&lt;/EM&gt;&amp;nbsp;* 100 (hence the name), which is typically slightly larger than 100&lt;EM&gt;p&lt;/EM&gt; because of the rounding mentioned above. Please note that &lt;EM&gt;n&lt;/EM&gt; refers to the number of observations &lt;EM&gt;with non-missing values&lt;/EM&gt; of the analysis variable (in the respective BY group, if any), hence it can vary between analysis variables.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 11:25:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272690#M14359</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-24T11:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: winsorized mean and proc univariate ods</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272703#M14361</link>
      <description>&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the explanation. As you can see in my ods table the halfp variable is named "Percent trimmed in tail" (at least it seems what the code you posted extract as "Halfp")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe a matter of labels only??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3313i7AF54BABCEA806E1/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="res.png" title="res.png" /&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 12:49:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272703#M14361</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2016-05-24T12:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: winsorized mean and proc univariate ods</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272709#M14362</link>
      <description>&lt;P&gt;Exactly. "Percent Winsorized in Tail" and "Percent Trimmed in Tail" are the labels of HALFP in the respective ODS output datasets.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 12:57:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272709#M14362</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-24T12:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: winsorized mean and proc univariate ods</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272724#M14364</link>
      <description>&lt;P&gt;Last question (I hope &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would be really helpful If you have any link to share wher eI cna find the real variable names associated to each value of the ods table (like halfp) , in order to be able to extract also the others data too&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For what you have seen I just have labels that do not correspond to the real name of the variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Davide&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 13:30:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272724#M14364</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2016-05-24T13:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: winsorized mean and proc univariate ods</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272735#M14367</link>
      <description>1) Use PROC CONTENTS SHORT to see names of variables.&lt;BR /&gt;2) If you want to also see observations, use PROC PRINT. The default table shows variable names, not labels.&lt;BR /&gt;3) If you bring up a table view in Windowing Environment (DMS), click View--&amp;gt;Column Names</description>
      <pubDate>Tue, 24 May 2016 13:44:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272735#M14367</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-05-24T13:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: winsorized mean and proc univariate ods</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272737#M14368</link>
      <description>&lt;P&gt;Personally, I virtually always use listing output of PROC PRINT etc. to look into datasets. In PROC PRINT, for example, variable names are displayed by default and labels only on request. I don't know how you usually view datasets. If you use VIEWTABLE mode, you can switch from labels to names via the View menu (which has items "Column Labels" and "Column Names"). PROC CONTENTS (with default settings) displays both, regardless of the output destination.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 13:45:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/winsorized-mean-and-proc-univariate-ods/m-p/272737#M14368</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-24T13:45:52Z</dc:date>
    </item>
  </channel>
</rss>

