<?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: Computing means...without proc MEANS in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Computing-means-without-proc-MEANS/m-p/360174#M64413</link>
    <description>&lt;P&gt;Thank you for your response, it turns out my code worked exactly as intended - i am not sure why it was collapsing the data int he begiining. But upon clearing sas and re-running my code- it turned out well. Thank you!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 20 May 2017 05:15:52 GMT</pubDate>
    <dc:creator>Mila</dc:creator>
    <dc:date>2017-05-20T05:15:52Z</dc:date>
    <item>
      <title>Computing means...without proc MEANS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Computing-means-without-proc-MEANS/m-p/359721#M64388</link>
      <description>&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying ot compute means across every row of data (say 3000) that i have in my dataset. There are 3000 rows and 50 columns - and the mean is looking ot average 8 of the 50 columns across 3000 lines.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the code i have written, but it collapses the data into 1 average, which is not what i am looking for. How do i get it to average across 8 variables for each of the 3000 rows?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would proc means work here? When i tried it, it appeared as though that would would collapse the data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; ccm_crsp_monthly4;&lt;/P&gt;&lt;P&gt;array x[&lt;STRONG&gt;8&lt;/STRONG&gt;] DP_Rank PPE_Rank PS_Rank TPS_Rank CF_Rank TFO_Rank PSR_Rank DPS_Rank;&lt;/P&gt;&lt;P&gt;array y[&lt;STRONG&gt;6&lt;/STRONG&gt;] DS_Rank RO_Rank PS_Rank TPS_Rank PR_Rank XPS_Rank;&lt;/P&gt;&lt;P&gt;SixVar=mean(of y[*]);&lt;/P&gt;&lt;P&gt;EightVar=mean(of x[*]);&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More failed attempts - proc means:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;means&lt;/STRONG&gt; DATA=ccm_monthly;&lt;/P&gt;&lt;P&gt;class date permno;&lt;/P&gt;&lt;P&gt;var DS_Rank PPE_Rank PS_Rank TPS_Rank XS_Rank XRS_Rank;&lt;/P&gt;&lt;P&gt;output&lt;/P&gt;&lt;P&gt;out=cc_monthly4(drop=_TYPE_ _FREQ_) mean=SixVariable;&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thsi should be a really simple things to do...lol!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 17:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Computing-means-without-proc-MEANS/m-p/359721#M64388</guid>
      <dc:creator>Mila</dc:creator>
      <dc:date>2017-05-18T17:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Computing means...without proc MEANS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Computing-means-without-proc-MEANS/m-p/359724#M64389</link>
      <description>&lt;P&gt;You really should provide a small example data set and what&amp;nbsp;the result for that example data should be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your comment "but it collapses the data into 1 average" is not very descriptive since the code you show would create 2 variables with the means of the two arrays for each row of data. If that isn't what you want then you need to show a very explicit example. The example need not include all 14 variables, probably the first 3 variables of each array and values that are not the same for each variable and row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a data then Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 17:13:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Computing-means-without-proc-MEANS/m-p/359724#M64389</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-18T17:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Computing means...without proc MEANS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Computing-means-without-proc-MEANS/m-p/359726#M64390</link>
      <description>Where is you Set Statement?&lt;BR /&gt;&lt;BR /&gt;data ccm_crsp_monthly4;&lt;BR /&gt;&lt;BR /&gt;array x[8] DP_Rank PPE_Rank PS_Rank TPS_Rank CF_Rank TFO_Rank PSR_Rank DPS_Rank;&lt;BR /&gt;&lt;BR /&gt;array y[6] DS_Rank RO_Rank PS_Rank TPS_Rank PR_Rank XPS_Rank;&lt;BR /&gt;&lt;BR /&gt;/* SET &amp;lt;lib.&amp;gt;dataset; */&lt;BR /&gt;SixVar=mean(of y[*]);&lt;BR /&gt;&lt;BR /&gt;EightVar=mean(of x[*]);&lt;BR /&gt;&lt;BR /&gt;Run;</description>
      <pubDate>Thu, 18 May 2017 17:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Computing-means-without-proc-MEANS/m-p/359726#M64390</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2017-05-18T17:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Computing means...without proc MEANS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Computing-means-without-proc-MEANS/m-p/359738#M64391</link>
      <description>&lt;BLOCKQUOTE&gt;Below is the code i have written, but it collapses the data into 1 average, which is not what i am looking for. How do i get it to average across 8 variables for each of the 3000 rows?&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sometimes words across the internet fail to have the intended meaning, I just don't understand this sentence, and it would be &lt;EM&gt;extremely&lt;/EM&gt; helpful if you could show us an example of what this sentence really means.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, in general, if you want to average numbers left-to-right (or right-to-left) within an observation, you need to use the MEAN function in a datastep.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to average down columns, you can use PROC MEANS. The only way to get PROC MEANS to average right-to-left within a row is to first transpose the data set so that what used to be a row is now a column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 17:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Computing-means-without-proc-MEANS/m-p/359738#M64391</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-05-18T17:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Computing means...without proc MEANS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Computing-means-without-proc-MEANS/m-p/360174#M64413</link>
      <description>&lt;P&gt;Thank you for your response, it turns out my code worked exactly as intended - i am not sure why it was collapsing the data int he begiining. But upon clearing sas and re-running my code- it turned out well. Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 May 2017 05:15:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Computing-means-without-proc-MEANS/m-p/360174#M64413</guid>
      <dc:creator>Mila</dc:creator>
      <dc:date>2017-05-20T05:15:52Z</dc:date>
    </item>
  </channel>
</rss>

