<?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: winsoring outliers in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/529770#M144807</link>
    <description>&lt;P&gt;You are missing &lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;by&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt; gvkey&lt;/SPAN&gt; in many steps.&lt;/P&gt;</description>
    <pubDate>Thu, 24 Jan 2019 17:34:39 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2019-01-24T17:34:39Z</dc:date>
    <item>
      <title>winsoring outliers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/528638#M144312</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm running the following regression (a Fama MecBeth regression):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;proc sort data=WORK.QUERY out=FM_quadric_reg1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;&amp;nbsp;by gvkey;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;run;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000ff"&gt;PROC REG DATA=FM_quadric_reg1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;&amp;nbsp;&amp;nbsp;outest=FM_quadric_reg011 noprint outseb;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;MODEL y=&amp;nbsp;x1 x2;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; by gvkey ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;&amp;nbsp; RUN;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;QUIT;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;proc means data=FM_quadric_reg011 n mean t probt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;&amp;nbsp;where _TYPE_ = 'PARMS';&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;run;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;N&lt;FONT color="#000000"&gt;&lt;FONT color="#000000"&gt;ow I want to winsore the outliers: for both beta 1&amp;nbsp;, beta 2, and the intercept, I want to turn values of that exceed mean&amp;nbsp; plus 3 std dev to the value of mean plus 3 std dev and to turn the values that below mean minus 3 std dev to the value of mean minus 3 std dev.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;&lt;FONT color="#000000"&gt;I want to do it for both beta 1 (the coefficient of x1)&amp;nbsp;, beta 2 (the coefficient of x2) and the intercept.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;could you please assist in writing the code for that?&lt;P&gt;&amp;nbsp;&lt;/P&gt;Thank you,&lt;/DIV&gt;&lt;DIV&gt;Lior &lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 20 Jan 2019 19:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/528638#M144312</guid>
      <dc:creator>lioradam</dc:creator>
      <dc:date>2019-01-20T19:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: winsoring outliers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/528647#M144313</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/133482"&gt;@lioradam&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm running the following regression (a Fama MecBeth regression):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;proc sort data=WORK.QUERY out=FM_quadric_reg1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;&amp;nbsp;by gvkey;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;run;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT color="#0000ff"&gt;PROC REG DATA=FM_quadric_reg1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;&amp;nbsp;&amp;nbsp;outest=FM_quadric_reg011 noprint outseb;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;MODEL y=&amp;nbsp;x1 x2;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; by gvkey ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;&amp;nbsp; RUN;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;QUIT;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;proc means data=FM_quadric_reg011 n mean t probt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;&amp;nbsp;where _TYPE_ = 'PARMS';&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;run;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;N&lt;FONT color="#000000"&gt;&lt;FONT color="#000000"&gt;ow I want to winsore the outliers: for both beta 1&amp;nbsp;, beta 2, and the intercept, I want to turn values of that exceed mean&amp;nbsp; plus 3 std dev to the value of mean plus 3 std dev and to turn the values that below mean minus 3 std dev to the value of mean minus 3 std dev.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT color="#000000"&gt;&lt;FONT color="#000000"&gt;I want to do it for both beta 1 (the coefficient of x1)&amp;nbsp;, beta 2 (the coefficient of x2) and the intercept.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;could you please assist in writing the code for that?
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
Thank you,&lt;/DIV&gt;
&lt;DIV&gt;Lior
&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So you get many different beta1 and beta2 and intercept because of the BY statement. It's not clear that they should be winsorized, or that the different beta1, beta2 and intercept across the BY groups would have the same distribution allowing winsorizing to make sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You'd have to be willing to produce reasons to your clients why Winsorizing makes sense here. I'm trying to think of an example, and the only example I can think of is a simulation experiment, where the BY is for different iterations in the simulation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you can take the output data set PROC MEANS and then merge that into the coefficients to determine if they are byond 3 sigma. Something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=FM_quadric_reg011;
    where _TYPE_ = 'PARMS';
    output out=_stats_ mean= std=/autoname;
run;
 
Data fm_quadric_reg011a;
    if _n_=1 then set _stats_;
    set fm_quadric_reg011;
    /* Formula for winsorizing goes here */
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Jan 2019 22:32:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/528647#M144313</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-20T22:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: winsoring outliers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/528651#M144315</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That being said, here's an example of how to cap results, it's not efficient by any means, but it works.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gist.github.com/statgeek/31316a678433a1db8136" target="_blank"&gt;https://gist.github.com/statgeek/31316a678433a1db8136&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Jan 2019 23:05:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/528651#M144315</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-20T23:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: winsoring outliers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/528653#M144322</link>
      <description>&lt;P&gt;This isn't winsorizing. Winsorizing involves censoring the same number of values from the lower and upper tail of the distribution. What you describe can be done with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=WORK.QUERY out=FM_quadric_reg1;
 by gvkey;
run;
 
PROC REG DATA=FM_quadric_reg1
  outest=FM_quadric_reg011 noprint outseb;
BY gvkey ;
MODEL y= x1 x2;
RUN;

proc sql;
create table FM_quadric_reg011_Winz as
select 
    *,
    case when abs(intercept-mean(intercept)) &amp;gt; 3 * std(intercept) 
    then mean(intercept) + sign(intercept-mean(intercept)) * 3 * std(intercept) 
    else intercept end as winz_intercept,
    case when abs(x1-mean(x1)) &amp;gt; 3 * std(x1) 
    then mean(x1) + sign(x1-mean(x1)) * 3 * std(x1) 
    else x1 end as winz_x1,    
    case when abs(intercept-mean(intercept)) &amp;gt; 3 * std(x2) 
    then mean(x2) + sign(x2-mean(x2)) * 3 * std(x2) 
    else x2 end as winz_x2
from FM_quadric_reg011
where _type_ = "PARMS";
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 20 Jan 2019 23:41:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/528653#M144322</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-01-20T23:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: winsoring outliers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/528687#M144332</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The method of calculating many&amp;nbsp;&lt;SPAN&gt;beta1 and beta2 and intercept&lt;/SPAN&gt; is common practice in accounting research and it aimed to treat a possible collinearity between observations.&amp;nbsp; then the mean value of&amp;nbsp;&lt;SPAN&gt;beta1 and beta2 and intercept&lt;/SPAN&gt;&amp;nbsp; are calculated . so as any mean calculation its affected by outliers, and there for it needed to be addressed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any way thank you for your assistance!&lt;/P&gt;&lt;P&gt;Lior&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 06:46:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/528687#M144332</guid>
      <dc:creator>lioradam</dc:creator>
      <dc:date>2019-01-21T06:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: winsoring outliers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/528691#M144333</link>
      <description>&lt;P&gt;Hi Rezza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used PG code however the code you sent looks also suitable for me.&lt;/P&gt;&lt;P&gt;thank you very much!&lt;/P&gt;&lt;P&gt;Lior&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 07:00:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/528691#M144333</guid>
      <dc:creator>lioradam</dc:creator>
      <dc:date>2019-01-21T07:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: winsoring outliers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/528693#M144334</link>
      <description>&lt;P&gt;Hi PG,&lt;/P&gt;&lt;P&gt;I used it and it worked perfectly (I calculate it also manually to verify that this is what I attend to receive).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;Lior&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 07:03:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/528693#M144334</guid>
      <dc:creator>lioradam</dc:creator>
      <dc:date>2019-01-21T07:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: winsoring outliers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/529382#M144630</link>
      <description>&lt;P&gt;Hi PG,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to try another type of winsoring, instead of winzoring coefficients above mean plus 3 STD (or below mean minus 3 STD), I want to do winsoring for coefficient values above 95% or below 5%.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please assist how to adjust the code you wrote accordingly?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Lior&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 13:43:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/529382#M144630</guid>
      <dc:creator>lioradam</dc:creator>
      <dc:date>2019-01-23T13:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: winsoring outliers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/529441#M144663</link>
      <description>&lt;P&gt;SQL doesn't provide percentile summaries, other than the median. So you will have to use a different approach, such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=FM_quadric_reg011;
by gvkey;
var intercept x1 x2;
output out=FM_quadric_reg011_summ p5= p95= / autoname;
run;

data FM_quadric_reg011_Winz;
merge FM_quadric_reg011 FM_quadric_reg011_summ; by gvkey;
intercept = min(max(intercept, intercept_p5), intercept_p95);
x1 = min(max(x1, x1_p5), x1_p95);
x2 = min(max(x2, x2_p5), x2_p95);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Jan 2019 16:40:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/529441#M144663</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-01-23T16:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: winsoring outliers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/529642#M144749</link>
      <description>&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&lt;FONT color="#000000"&gt;Hi PG,&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&lt;FONT color="#000000"&gt;Thank you for your response.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&lt;FONT color="#000000"&gt;I wrote the following code, based on your suggestion, but for some reason, I received different result than when winsoring manually (for verification).&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&lt;FONT color="#000000"&gt;Also, I don't see "output data" of "FM_quadric_regr11_Winz",&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN style="background: white; margin: 0px; font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&lt;SPAN style="margin: 0px;"&gt;&amp;nbsp;&lt;/SPAN&gt;and when I remove the condition " where _TYPE_ = 'PARMS'" from the "proc summary" I still receive the same results (the same value of "&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt; winz_year_of_tenure2" for&lt;SPAN style="margin: 0px;"&gt;&amp;nbsp; &lt;/SPAN&gt;example) which don't make sense.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&lt;FONT color="#000000"&gt;Could you please try to see what I wrote incorrectly?&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&lt;FONT color="#000000"&gt;The code I wrote:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;proc&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;sort&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;data&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;=WORK.QUERY_FOR_FINAL1_0001 &lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;out&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;=FM_quadric_reg1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;&lt;SPAN style="margin: 0px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;by&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt; gvkey ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;run&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;PROC&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;REG&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;DATA&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;=FM_quadric_reg1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;&lt;SPAN style="margin: 0px;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;outest&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;=FM_quadric_regr11 &lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;noprint&lt;/SPAN&gt; &lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;outseb&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;&lt;SPAN style="margin: 0px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;MODEL&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt; y = x1 x2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;&lt;SPAN style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;by&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt; gvkey ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;RUN&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;QUIT&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;proc&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;summary&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;data&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;=FM_quadric_regr11;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;var&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt; intercept x1 x2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;output&lt;/SPAN&gt; &lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;out&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;=FM_quadric_regr11_summ &lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;p5&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;= &lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;p95&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;= / &lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;autoname&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;&lt;SPAN style="margin: 0px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;where&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt; _TYPE_ = &lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: purple; font-family: 'Courier New';"&gt;'PARMS'&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;quit&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt; FM_quadric_regr11_Winz;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;merge&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt; FM_quadric_regr11 FM_quadric_regr11_summ; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;intercept = min(max(intercept, intercept_p5), intercept_p95);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;x1 = min(max(x1, x1_p5), x1_p95);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;x2 = min(max(x2, x2_p5), x2_p95);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;quit&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;proc&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;means&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;data&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;=FM_quadric_regr11_Winz &lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;n&lt;/SPAN&gt; &lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;mean&lt;/SPAN&gt; &lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;t&lt;/SPAN&gt; &lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;probt&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;&lt;SPAN style="margin: 0px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;where&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt; _TYPE_ = &lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: purple; font-family: 'Courier New';"&gt;'PARMS'&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: navy; font-family: 'Courier New';"&gt;run&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri"&gt;Thank you,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri"&gt;Lior&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 09:25:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/529642#M144749</guid>
      <dc:creator>lioradam</dc:creator>
      <dc:date>2019-01-24T09:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: winsoring outliers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/529770#M144807</link>
      <description>&lt;P&gt;You are missing &lt;SPAN style="background: white; margin: 0px; color: blue; font-family: 'Courier New';"&gt;by&lt;/SPAN&gt;&lt;SPAN style="background: white; margin: 0px; color: black; font-family: 'Courier New';"&gt; gvkey&lt;/SPAN&gt; in many steps.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 17:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/529770#M144807</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-01-24T17:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: winsoring outliers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/529941#M144876</link>
      <description>&lt;P&gt;I&amp;nbsp;intentionally didn't include "by gvkey" in the "proc summary" because I want to calculate p5 and p95 of all the rows together. (the entire table).&lt;/P&gt;&lt;P&gt;there for the table&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 21px; -ms-hyphens: none; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: 0px; word-wrap: normal;"&gt;FM_quadric_reg011_summ&lt;/SPAN&gt; include only one row, while the table&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 21px; -ms-hyphens: none; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: 0px; word-wrap: normal;"&gt;FM_quadric_reg011&lt;/SPAN&gt; including many rows (as the number of gvkey). that's why the merge procedure does not work.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 01:29:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/529941#M144876</guid>
      <dc:creator>lioradam</dc:creator>
      <dc:date>2019-01-25T01:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: winsoring outliers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/529950#M144881</link>
      <description>&lt;P&gt;If you're trying to merge a data set with multiple rows, with on with a single row you do it this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set multipleRows;

if _n_ = 1 then set OneRow;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/133482"&gt;@lioradam&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I&amp;nbsp;intentionally didn't include "by gvkey" in the "proc summary" because I want to calculate p5 and p95 of all the rows together. (the entire table).&lt;/P&gt;
&lt;P&gt;there for the table&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 21px; -ms-hyphens: none; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: 0px; word-wrap: normal;"&gt;FM_quadric_reg011_summ&lt;/SPAN&gt; include only one row, while the table&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 21px; -ms-hyphens: none; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: 0px; word-wrap: normal;"&gt;FM_quadric_reg011&lt;/SPAN&gt; including many rows (as the number of gvkey). that's why the merge procedure does not work.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 02:17:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/529950#M144881</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-25T02:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: winsoring outliers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/530287#M144990</link>
      <description>&lt;P&gt;Thank you Reeza !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 00:46:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/winsoring-outliers/m-p/530287#M144990</guid>
      <dc:creator>lioradam</dc:creator>
      <dc:date>2019-01-26T00:46:06Z</dc:date>
    </item>
  </channel>
</rss>

