<?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: creating quarterly obs for a monthly time series in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/creating-quarterly-obs-for-a-monthly-time-series/m-p/62243#M13552</link>
    <description>Hello Jdub,&lt;BR /&gt;
&lt;BR /&gt;
Look at nway description in SAS help it explains the use of nway in detail. &lt;BR /&gt;
&lt;BR /&gt;
"I am guessing you used nway b.c. you have two classes, yes?" it does not matter how many classes do you have. For example, in your code you have only one class but Meanvalue contains means for total dataset (not divided in classes for _type_=0 ) and for each value of the class (_type_=1). If you add nway option then only means for different values of class variable are calculated. If you have several classes then with nway option proc means calculates means for all combinations of class values.&lt;BR /&gt;
&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
    <pubDate>Thu, 05 May 2011 13:44:19 GMT</pubDate>
    <dc:creator>SPR</dc:creator>
    <dc:date>2011-05-05T13:44:19Z</dc:date>
    <item>
      <title>creating quarterly obs for a monthly time series</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-quarterly-obs-for-a-monthly-time-series/m-p/62240#M13549</link>
      <description>I have a monthly time series and want to make quarterly observations.  I started by assigning observations to quarters and thought to somehow use proc means to generate the average value of each trio of year-quarter values.  How do I use proc means to create mean values where of all like year and quarter values?&lt;BR /&gt;
&lt;BR /&gt;
data structure:&lt;BR /&gt;
year month quarter value&lt;BR /&gt;
1992 1 2 x&lt;BR /&gt;
1992 2 2 y&lt;BR /&gt;
1992 3 2 z&lt;BR /&gt;
1992 4 3 a&lt;BR /&gt;
1992 5 3 b&lt;BR /&gt;
1992 6 3 c&lt;BR /&gt;
&lt;BR /&gt;
Goal: use proc means to calc:&lt;BR /&gt;
(x + y z) / 3 , (a + b + c) / 3</description>
      <pubDate>Wed, 04 May 2011 20:30:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-quarterly-obs-for-a-monthly-time-series/m-p/62240#M13549</guid>
      <dc:creator>jdub</dc:creator>
      <dc:date>2011-05-04T20:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: creating quarterly obs for a monthly time series</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-quarterly-obs-for-a-monthly-time-series/m-p/62241#M13550</link>
      <description>Hello Jdub,&lt;BR /&gt;
&lt;BR /&gt;
This is a solution:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data i;&lt;BR /&gt;
input year month quarter value;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1992 1 2 10&lt;BR /&gt;
1992 2 2 11&lt;BR /&gt;
1992 3 2 12&lt;BR /&gt;
1992 4 3 21&lt;BR /&gt;
1992 5 3 22&lt;BR /&gt;
1992 6 3 23&lt;BR /&gt;
run;&lt;BR /&gt;
proc means data=i nway noprint;&lt;BR /&gt;
  output out=Mean(drop=_:) Mean=Mean;&lt;BR /&gt;
  var value;&lt;BR /&gt;
  class Year Quarter;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Wed, 04 May 2011 21:09:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-quarterly-obs-for-a-monthly-time-series/m-p/62241#M13550</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-05-04T21:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: creating quarterly obs for a monthly time series</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-quarterly-obs-for-a-monthly-time-series/m-p/62242#M13551</link>
      <description>SPR, &lt;BR /&gt;
&lt;BR /&gt;
Thank you for the soln.  I navigated my way to a less elegant soln.  I concatenated year and quarter and used:&lt;BR /&gt;
proc means data=i;&lt;BR /&gt;
class=yrqt;&lt;BR /&gt;
var=value;&lt;BR /&gt;
output out=Meanvalue Mean=value;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
For the sake of learning, why did you specify nway?  Can class work on combinations of variables like Year Quarter - don't they need to be concatenated?  I am guessing you used nway b.c. you have two classes, yes?</description>
      <pubDate>Wed, 04 May 2011 21:30:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-quarterly-obs-for-a-monthly-time-series/m-p/62242#M13551</guid>
      <dc:creator>jdub</dc:creator>
      <dc:date>2011-05-04T21:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: creating quarterly obs for a monthly time series</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-quarterly-obs-for-a-monthly-time-series/m-p/62243#M13552</link>
      <description>Hello Jdub,&lt;BR /&gt;
&lt;BR /&gt;
Look at nway description in SAS help it explains the use of nway in detail. &lt;BR /&gt;
&lt;BR /&gt;
"I am guessing you used nway b.c. you have two classes, yes?" it does not matter how many classes do you have. For example, in your code you have only one class but Meanvalue contains means for total dataset (not divided in classes for _type_=0 ) and for each value of the class (_type_=1). If you add nway option then only means for different values of class variable are calculated. If you have several classes then with nway option proc means calculates means for all combinations of class values.&lt;BR /&gt;
&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Thu, 05 May 2011 13:44:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-quarterly-obs-for-a-monthly-time-series/m-p/62243#M13552</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-05-05T13:44:19Z</dc:date>
    </item>
  </channel>
</rss>

