<?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: Weighted Mean in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376072#M19717</link>
    <description>&lt;P&gt;There are two ideas being discussed here.&lt;/P&gt;
&lt;P&gt;1. The OP asked about a "weighted mean" of VARIABLES, but it seems what she really wants is a linear combination of six variables, where the coefficients change if one or more variables have missing values.&lt;/P&gt;
&lt;P&gt;2. There were a few comments about using PROC EXPAND, which computes a moving average of OBSERVATIONS. I see no evidence that this is what the OP wants.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason I think that the OP wants (1) is because she mentions principal components.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mila: The SUM function handles missing values, whereas the '+' operator propagates missing values. That is why someone suggested using SUM.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to standardize the weights, just divide the sum by the sum of the weights, For example&lt;/P&gt;
&lt;P&gt;y = sum(A1*x1, A2*x2, ..., A6*x6) / sum(&lt;SPAN&gt;A1, A2, ..., A6&lt;/SPAN&gt;);&lt;/P&gt;
&lt;P&gt;See the article &lt;A href="http://blogs.sas.com/content/iml/2016/01/06/weighted-mean-in-sas.html" target="_self"&gt;"Compute a weighted mean in SAS."&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Jul 2017 15:35:37 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2017-07-14T15:35:37Z</dc:date>
    <item>
      <title>Weighted Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/375928#M19693</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i am trying to compute some weighted means of 6 variables acorss time (time series). However, in some time periods one or two or more variables could be misisng. A brute forece weighted means approach would result in 'NO MEAN' being computed for any misisng data, how do i force it to compute a mean and re-weight when data is missing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is some code i have - would i have to use proc means? I have tried to brute force it, and i am sure it making simplications to the code i butchered it, but this doesnt acocunt for 2,3,4,or all 5, variables msising. Is there an easier way to do this?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data B;
Set A;
&amp;nbsp;
if missing(E) then SixVar=0.2099*A+ 0.1871*B+ 0.1458*C+ 0.1955*D+ 0.2617*E;
else if missing(E) then SixEFAVar=0.2291*A +0.1894*B + 0.1688*C+ 0.1765*D+ 0.2362*E;
else if missing(C) then SixEFAVar=0.2380*A+ 0.1968*B+ 0.1366*E+ 0.1833*D+ 0.2453*E;
else if missing(D) then SixEFAVar=0.2398*A+0.1983*B+ 0.1768*C+ 0.1377*E+ 0.2473*E;
else if missing(B) then SixEFAVar=0.2432*A+ 0.1792*C+ 0.1396*E+ 0.1873*D+ 0.2507*E;
else if missing(E) then SixEFAVar=0.2558*A+0.2116*B+ 0.1886*C+ 0.1469*E+ 0.1971*D;
else SixEFAVar=0.2024*A+ 0.1674*B+ 0.1492*C+ 0.1163*E+ 0.1559*D+ 0.2087*E;
&amp;nbsp;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 14:48:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/375928#M19693</guid>
      <dc:creator>Mila</dc:creator>
      <dc:date>2017-07-14T14:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: Weigthed Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/375932#M19694</link>
      <description>&lt;P&gt;Use PROC EXPAND as in this example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/01/27/moving-average-in-sas.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2016/01/27/moving-average-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 07:09:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/375932#M19694</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-07-14T07:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: Weigthed Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/375934#M19695</link>
      <description>&lt;P&gt;try the sum function&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data B;
Set A;
if missing(E) then SixVar=sum(0.2099*A, 0.1871*B, 0.1458*C, 0.1955*D, 0.2617*E);
else if missing(E) then SixEFAVar=sum(0.2291*A ,0.1894*B , 0.1688*C, 0.1765*D, 0.2362*E);
else if missing(C) then SixEFAVar=sum(0.2380*A, 0.1968*B, 0.1366*E, 0.1833*D, 0.2453*E);
else if missing(D) then SixEFAVar=sum(0.2398*A,0.1983*B, 0.1768*C, 0.1377*E, 0.2473*E);
else if missing(B) then SixEFAVar=sum(0.2432*A, 0.1792*C, 0.1396*E, 0.1873*D, 0.2507*E);
else if missing(E) then SixEFAVar=sum(0.2558*A,0.2116*B, 0.1886*C, 0.1469*E, 0.1971*D);
else SixEFAVar=sum(0.2024*A, 0.1674*B, 0.1492*C, 0.1163*E, 0.1559*D, 0.2087*E);
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Jul 2017 07:11:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/375934#M19695</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-07-14T07:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Weigthed Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376002#M19705</link>
      <description>&lt;P&gt;hi there would u be able to help me out with syntax- i seem to having issues- is the wma function built for time series data in that it is average acorss time?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I apologize if my post was confusing- while my data is a time series, i intend to calculate weighted moving averages in each time period. So i intend to average 6 variables in each time period, here is what i have and it is erorring out:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc expand data=ccm_crsp_monthly4ComboA out=ccm_crsp_monthly4Combo method=none;&lt;BR /&gt;id DATE;&lt;BR /&gt;y [6] A B C D E F&lt;BR /&gt;convert y = WMA / transout=(movave(0.1739 0.1723 0.159 0.1467 0.164 0.1838));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if i were to add a ";" behing line 3 convert erorrs out&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 13:50:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376002#M19705</guid>
      <dc:creator>Mila</dc:creator>
      <dc:date>2017-07-14T13:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: Weigthed Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376004#M19706</link>
      <description>Would you be able to help me understand why conceptually this would work? tq</description>
      <pubDate>Fri, 14 Jul 2017 13:56:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376004#M19706</guid>
      <dc:creator>Mila</dc:creator>
      <dc:date>2017-07-14T13:56:49Z</dc:date>
    </item>
    <item>
      <title>Weighted Averages (WMA) in each time period repeated across time</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376021#M19708</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to compute weighted means of 6 variables in each time period (given weights that sum to 1) and then for the process to be repeated with exact same weights across each time. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data is such that in some time periods one or two or more variables could be missing. A brute force weighted means approach would result in 'NO MEAN' being computed for any missing data. How can I force the code to compute a mean regardless and to re-weight the remaining data when some data is missing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are two thing I have tried but failed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data B&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;Set A;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if missing(E) then SixVar=&lt;STRONG&gt;0.2099&lt;/STRONG&gt;*A+&amp;nbsp;&lt;STRONG&gt;0.1871&lt;/STRONG&gt;*B+&amp;nbsp;&lt;STRONG&gt;0.1458&lt;/STRONG&gt;*C+&amp;nbsp;&lt;STRONG&gt;0.1955&lt;/STRONG&gt;*D+&amp;nbsp;&lt;STRONG&gt;0.2617&lt;/STRONG&gt;*E;&lt;/P&gt;&lt;P&gt;else if missing(E) then SixEFAVar=&lt;STRONG&gt;0.2291&lt;/STRONG&gt;*A +&lt;STRONG&gt;0.1894&lt;/STRONG&gt;*B +&amp;nbsp;&lt;STRONG&gt;0.1688&lt;/STRONG&gt;*C+&amp;nbsp;&lt;STRONG&gt;0.1765&lt;/STRONG&gt;*D+&amp;nbsp;&lt;STRONG&gt;0.2362&lt;/STRONG&gt;*E;&lt;/P&gt;&lt;P&gt;else if missing(C) then SixEFAVar=&lt;STRONG&gt;0.2380&lt;/STRONG&gt;*A+&amp;nbsp;&lt;STRONG&gt;0.1968&lt;/STRONG&gt;*B+&amp;nbsp;&lt;STRONG&gt;0.1366&lt;/STRONG&gt;*E+&amp;nbsp;&lt;STRONG&gt;0.1833&lt;/STRONG&gt;*D+&amp;nbsp;&lt;STRONG&gt;0.2453&lt;/STRONG&gt;*E;&lt;/P&gt;&lt;P&gt;else if missing(D) then SixEFAVar=&lt;STRONG&gt;0.2398&lt;/STRONG&gt;*A+&lt;STRONG&gt;0.1983&lt;/STRONG&gt;*B+&amp;nbsp;&lt;STRONG&gt;0.1768&lt;/STRONG&gt;*C+&amp;nbsp;&lt;STRONG&gt;0.1377&lt;/STRONG&gt;*E+&amp;nbsp;&lt;STRONG&gt;0.2473&lt;/STRONG&gt;*E;&lt;/P&gt;&lt;P&gt;else if missing(B) then SixEFAVar=&lt;STRONG&gt;0.2432&lt;/STRONG&gt;*A+&amp;nbsp;&lt;STRONG&gt;0.1792&lt;/STRONG&gt;*C+&amp;nbsp;&lt;STRONG&gt;0.1396&lt;/STRONG&gt;*E+&amp;nbsp;&lt;STRONG&gt;0.1873&lt;/STRONG&gt;*D+&amp;nbsp;&lt;STRONG&gt;0.2507&lt;/STRONG&gt;*E;&lt;/P&gt;&lt;P&gt;else if missing(E) then SixEFAVar=&lt;STRONG&gt;0.2558&lt;/STRONG&gt;*A+&lt;STRONG&gt;0.2116&lt;/STRONG&gt;*B+&amp;nbsp;&lt;STRONG&gt;0.1886&lt;/STRONG&gt;*C+&amp;nbsp;&lt;STRONG&gt;0.1469&lt;/STRONG&gt;*E+&amp;nbsp;&lt;STRONG&gt;0.1971&lt;/STRONG&gt;*D;&lt;/P&gt;&lt;P&gt;else SixEFAVar=&lt;STRONG&gt;0.2024&lt;/STRONG&gt;*A+&amp;nbsp;&lt;STRONG&gt;0.1674&lt;/STRONG&gt;*B+&amp;nbsp;&lt;STRONG&gt;0.1492&lt;/STRONG&gt;*C+&amp;nbsp;&lt;STRONG&gt;0.1163&lt;/STRONG&gt;*E+&amp;nbsp;&lt;STRONG&gt;0.1559&lt;/STRONG&gt;*D+&amp;nbsp;&lt;STRONG&gt;0.2087&lt;/STRONG&gt;*E;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* Also experiment with proc expand- but maybe my understanding of this proc is flawed or syntax is incorrect */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc expand data=ccm_crsp_monthly4ComboA out=ccm_crsp_monthly4Combo method=none;&lt;BR /&gt;id DATE;&lt;BR /&gt;y [6] A B C D E F&lt;BR /&gt;convert y = WMA / transout=(movave(0.1739 0.1723 0.159 0.1467 0.164 0.1838));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any guidance would be much appreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 14:40:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376021#M19708</guid>
      <dc:creator>Mila</dc:creator>
      <dc:date>2017-07-14T14:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Weigthed Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376026#M19707</link>
      <description>&lt;P&gt;Are your weights stored in a table? If so, please post that as a sample dataset in addition to your data and expected output.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS. Please do not post the same question multiple times. I'll merge the two threads now.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 14:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376026#M19707</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-14T14:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: Weigthed Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376047#M19709</link>
      <description>No they are not, because they are literally 6 exogenously given weights from pca and efa analysis i have just harcoded them in below format</description>
      <pubDate>Fri, 14 Jul 2017 15:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376047#M19709</guid>
      <dc:creator>Mila</dc:creator>
      <dc:date>2017-07-14T15:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Weigthed Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376058#M19710</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/121713"&gt;@Mila&lt;/a&gt; wrote:&lt;BR /&gt;No they are not, because they are literally 6 exogenously given weights from pca and efa analysis i have just harcoded them in below format&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So you have 6 different set of weights, one for each case where one variable is missing? What happens if you have two variables that are missing? How are you 'rescaling' the weights for each missing values?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 15:20:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376058#M19710</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-14T15:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Weigthed Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376060#M19711</link>
      <description>&lt;P&gt;I was able to test the code out and below i am not getting a properly reweighted number:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The good news is that some number is being populated even in rows where 1,2,3 data points of the 6 i misisng - but i am unable to get the correct number having done this manually as a check (see image below)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code i have used is the following - assuming this does the reweighting for missing data (no need for if statements)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data ccm_crsp_monthly4Combo;&lt;BR /&gt;set ccm_crsp_monthly4;&lt;BR /&gt;SixPCAVar=sum(0.1739*A, 0.1723*B, 0.159*C, 0.1467*D, 0.1644*E, 0.1838*F;&lt;BR /&gt;SixEFAVar=sum(0.2024*A, 0.1674*B, 0.1492*C, 0.1163*D, 0.1559*E, 0.2087*F);&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/14074i4816A57D6A2A38E4/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Capture2.PNG" title="Capture2.PNG" /&gt;</description>
      <pubDate>Fri, 14 Jul 2017 15:21:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376060#M19711</guid>
      <dc:creator>Mila</dc:creator>
      <dc:date>2017-07-14T15:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Weigthed Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376064#M19712</link>
      <description>&lt;P&gt;No, the SUM() function&amp;nbsp;uses the same weights no matter what. But if a variable is missing it doesn't count towards the total. Given what you've stated so far that doesn't match your requirements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/121713"&gt;@Mila&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I was able to test the code out and below i am not getting a properly reweighted number:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The good news is that some number is being populated even in rows where 1,2,3 data points of the 6 i misisng - but i am unable to get the correct number having done this manually as a check (see image below)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code i have used is the following - assuming this does the reweighting for missing data (no need for if statements)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data ccm_crsp_monthly4Combo;&lt;BR /&gt;set ccm_crsp_monthly4;&lt;BR /&gt;SixPCAVar=sum(0.1739*A, 0.1723*B, 0.159*C, 0.1467*D, 0.1644*E, 0.1838*F;&lt;BR /&gt;SixEFAVar=sum(0.2024*A, 0.1674*B, 0.1492*C, 0.1163*D, 0.1559*E, 0.2087*F);&lt;BR /&gt;Run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 15:24:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376064#M19712</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-14T15:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Weigthed Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376066#M19713</link>
      <description>&lt;P&gt;Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the problem i am facing - the issue is i am not sure how best to rescale for missing values- someone suggested doing the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333; background: white;"&gt;data ccm_crsp_monthly4Combo;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;&lt;BR /&gt;&lt;SPAN style="background: white;"&gt;&lt;SPAN style="font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; float: none; word-spacing: 0px;"&gt;set ccm_crsp_monthly4;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="background: white;"&gt;&lt;SPAN style="font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; float: none; word-spacing: 0px;"&gt;SixPCAVar=sum(0.1739*A, 0.1723*B, 0.159*C, 0.1467*D, 0.1644*E, 0.1838*F);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="background: white;"&gt;&lt;SPAN style="font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; float: none; word-spacing: 0px;"&gt;SixEFAVar=sum(0.2024*A, 0.1674*B, 0.1492*C, 0.1163*D, 0.1559*E, 0.2087*F);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="background: white;"&gt;&lt;SPAN style="font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; float: none; word-spacing: 0px;"&gt;Run;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333; background: white;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333; background: white;"&gt;above seems to work in that, if there are missing datapoints it still populated a number- but the number is not consistent with rescaling to 100%&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333; background: white;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333; background: white;"&gt;I also tried proc expand as someone had suggested but I am struggling with syntax and that seems to want to do weights acorss dates instead of within the same date (maybe I am not understanding the procedure well enough):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333; background: white;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;proc expand data=ccm_crsp_monthly4ComboA out=ccm_crsp_monthly4Combo method=none;&lt;BR /&gt;id DATE;&lt;BR /&gt;y [6] A B C D E F&lt;BR /&gt;convert y = WMA / transout=(movave(0.1739 0.1723 0.159 0.1467 0.164 0.1838));&lt;BR /&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 15:25:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376066#M19713</guid>
      <dc:creator>Mila</dc:creator>
      <dc:date>2017-07-14T15:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Weigthed Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376069#M19714</link>
      <description>&lt;P&gt;Any suggestions as to how i can change that SUM to rescale to 100%&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 15:29:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376069#M19714</guid>
      <dc:creator>Mila</dc:creator>
      <dc:date>2017-07-14T15:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Weigthed Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376070#M19715</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/121713"&gt;@Mila&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the problem i am facing - the issue is i am not sure how best to rescale for missing values- someone suggested doing the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is a problem. You have to know what you wnat to do to be able to code it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I don't have time to code it now, but I suggest loading your weights into an array. Then calculate the number missing and weights you need, and rescale them as needed for each row. You can use an array to hold the new weights as well. Then do the multiplication.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 15:29:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376070#M19715</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-14T15:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: Weigthed Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376071#M19716</link>
      <description>&lt;P&gt;I see so id have to do it for each row- there isnt a precanned function or procedure for it? Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 15:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376071#M19716</guid>
      <dc:creator>Mila</dc:creator>
      <dc:date>2017-07-14T15:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376072#M19717</link>
      <description>&lt;P&gt;There are two ideas being discussed here.&lt;/P&gt;
&lt;P&gt;1. The OP asked about a "weighted mean" of VARIABLES, but it seems what she really wants is a linear combination of six variables, where the coefficients change if one or more variables have missing values.&lt;/P&gt;
&lt;P&gt;2. There were a few comments about using PROC EXPAND, which computes a moving average of OBSERVATIONS. I see no evidence that this is what the OP wants.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason I think that the OP wants (1) is because she mentions principal components.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mila: The SUM function handles missing values, whereas the '+' operator propagates missing values. That is why someone suggested using SUM.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to standardize the weights, just divide the sum by the sum of the weights, For example&lt;/P&gt;
&lt;P&gt;y = sum(A1*x1, A2*x2, ..., A6*x6) / sum(&lt;SPAN&gt;A1, A2, ..., A6&lt;/SPAN&gt;);&lt;/P&gt;
&lt;P&gt;See the article &lt;A href="http://blogs.sas.com/content/iml/2016/01/06/weighted-mean-in-sas.html" target="_self"&gt;"Compute a weighted mean in SAS."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 15:35:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376072#M19717</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-07-14T15:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376074#M19718</link>
      <description>&lt;P&gt;Thank you very much, this helps clear things up tremendously - best wishes&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 15:40:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376074#M19718</guid>
      <dc:creator>Mila</dc:creator>
      <dc:date>2017-07-14T15:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Weigthed Mean</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376075#M19719</link>
      <description>&lt;P&gt;Also btw....the misisng values issue is clearly delineated in the question "Grand Advisor" &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 15:50:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Weighted-Mean/m-p/376075#M19719</guid>
      <dc:creator>Mila</dc:creator>
      <dc:date>2017-07-14T15:50:41Z</dc:date>
    </item>
  </channel>
</rss>

