<?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: Find AVG for states in year/month in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Find-AVG-for-states-in-year-month/m-p/554531#M9521</link>
    <description>You need to use PROC MEANS most likely. It would be helpful if you provided more details, specifically what you want the output to look like. You may need to create a new variable or you can use some tricks to change the YearMonth variable into a Year value. &lt;BR /&gt;&lt;BR /&gt;Here's an example of how PROC MEANS would work. If you check my other examples, there's one that shows how to add the mean to the main data set. &lt;BR /&gt;&lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/proc_means_basic.sas" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/proc_means_basic.sas&lt;/A&gt;</description>
    <pubDate>Sat, 27 Apr 2019 22:34:28 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-04-27T22:34:28Z</dc:date>
    <item>
      <title>Find AVG for states in year/month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-AVG-for-states-in-year-month/m-p/554391#M9497</link>
      <description>I got one columb that’s in yearsmonth , one column of states and another column for spending. I want to take avg spending for a state in a year and start a new column/variable with the info in it.&lt;BR /&gt;&lt;BR /&gt;Ex&lt;BR /&gt;State_fips state_pc yearmonth spend&lt;BR /&gt;2. AK. 201202&lt;BR /&gt;3 AK. 201201&lt;BR /&gt;2. SD 201203&lt;BR /&gt;3. SD. 201304&lt;BR /&gt;3</description>
      <pubDate>Fri, 26 Apr 2019 20:09:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-AVG-for-states-in-year-month/m-p/554391#M9497</guid>
      <dc:creator>Noob314</dc:creator>
      <dc:date>2019-04-26T20:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Find AVG for states in year/month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-AVG-for-states-in-year-month/m-p/554399#M9499</link>
      <description>&lt;P&gt;First step in almost anything involving dates is to ensure that you have an actual SAS date valued numeric variable. Then there are a slew of tools to work with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best is to share what your actual data set is like using a data step. 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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to show what your desired output looks like. It is not clear whether you want a data set, for further processing, or a report that people will read.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 20:43:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-AVG-for-states-in-year-month/m-p/554399#M9499</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-26T20:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: Find AVG for states in year/month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-AVG-for-states-in-year-month/m-p/554531#M9521</link>
      <description>You need to use PROC MEANS most likely. It would be helpful if you provided more details, specifically what you want the output to look like. You may need to create a new variable or you can use some tricks to change the YearMonth variable into a Year value. &lt;BR /&gt;&lt;BR /&gt;Here's an example of how PROC MEANS would work. If you check my other examples, there's one that shows how to add the mean to the main data set. &lt;BR /&gt;&lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/proc_means_basic.sas" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/proc_means_basic.sas&lt;/A&gt;</description>
      <pubDate>Sat, 27 Apr 2019 22:34:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-AVG-for-states-in-year-month/m-p/554531#M9521</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-27T22:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: Find AVG for states in year/month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-AVG-for-states-in-year-month/m-p/554552#M9527</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you mean something like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
    select state, substr(yearmonth,1,4) as year,  avg(Spend_Amt) as Avg_spend_amt
  From table 
  group by state, substr(yearmonth,1,4);
Quit ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 28 Apr 2019 01:56:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-AVG-for-states-in-year-month/m-p/554552#M9527</guid>
      <dc:creator>smijoss1</dc:creator>
      <dc:date>2019-04-28T01:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Find AVG for states in year/month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-AVG-for-states-in-year-month/m-p/554555#M9528</link>
      <description>What if YearMonth is numeric?</description>
      <pubDate>Sun, 28 Apr 2019 02:05:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-AVG-for-states-in-year-month/m-p/554555#M9528</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-28T02:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Find AVG for states in year/month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-AVG-for-states-in-year-month/m-p/554565#M9532</link>
      <description>Then use substr(put(</description>
      <pubDate>Sun, 28 Apr 2019 08:26:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-AVG-for-states-in-year-month/m-p/554565#M9532</guid>
      <dc:creator>smijoss1</dc:creator>
      <dc:date>2019-04-28T08:26:05Z</dc:date>
    </item>
  </channel>
</rss>

