<?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 How to create year series? in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/How-to-create-year-series/m-p/167722#M1869</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My observations have FOUR variables: ID, DATE, year1 and year2. I want to create times series(frequency: yearly) data between year1 and year2.&lt;/P&gt;&lt;P&gt;I have already use proc transpose to create a variable YEAR which has year1 and year2 for each observation.&lt;/P&gt;&lt;P&gt;for example for observation A, if year1=1995 and year2=2006, then after the proc transpose I will have two observations A1 with YEAR=1995 and A2 with YEAR=2006.&lt;/P&gt;&lt;P&gt;Then I want to create all the time series observations with YEAR between 1995 and 2006. Namely, Year=1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I tried to use proc expand to solve the problem(I did so with monthly data), but the code below does not work:#&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;proc expand data=mysample out=mysample1 From=year to=year;&lt;/P&gt;&lt;P&gt;by ID Date;&lt;/P&gt;&lt;P&gt;id YEAR;&lt;/P&gt;&lt;P&gt;convert YEAR;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The code does not work. Is it because I should not use Proc expand or is there something wrong with the code? Or could anyone tell how to solve the problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Oct 2014 09:45:57 GMT</pubDate>
    <dc:creator>MR_Xishuai</dc:creator>
    <dc:date>2014-10-01T09:45:57Z</dc:date>
    <item>
      <title>How to create year series?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/How-to-create-year-series/m-p/167722#M1869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My observations have FOUR variables: ID, DATE, year1 and year2. I want to create times series(frequency: yearly) data between year1 and year2.&lt;/P&gt;&lt;P&gt;I have already use proc transpose to create a variable YEAR which has year1 and year2 for each observation.&lt;/P&gt;&lt;P&gt;for example for observation A, if year1=1995 and year2=2006, then after the proc transpose I will have two observations A1 with YEAR=1995 and A2 with YEAR=2006.&lt;/P&gt;&lt;P&gt;Then I want to create all the time series observations with YEAR between 1995 and 2006. Namely, Year=1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I tried to use proc expand to solve the problem(I did so with monthly data), but the code below does not work:#&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;proc expand data=mysample out=mysample1 From=year to=year;&lt;/P&gt;&lt;P&gt;by ID Date;&lt;/P&gt;&lt;P&gt;id YEAR;&lt;/P&gt;&lt;P&gt;convert YEAR;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The code does not work. Is it because I should not use Proc expand or is there something wrong with the code? Or could anyone tell how to solve the problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Oct 2014 09:45:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/How-to-create-year-series/m-p/167722#M1869</guid>
      <dc:creator>MR_Xishuai</dc:creator>
      <dc:date>2014-10-01T09:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to create year series?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/How-to-create-year-series/m-p/167723#M1870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xishuai,&lt;/P&gt;&lt;P&gt;Not sure if I understand right the structure of your data.&lt;/P&gt;&lt;P&gt;Can you provide an example of what your data looks like and the format that you need it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 21:16:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/How-to-create-year-series/m-p/167723#M1870</guid>
      <dc:creator>M_Maldonado</dc:creator>
      <dc:date>2014-10-02T21:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to create year series?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/How-to-create-year-series/m-p/167724#M1871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This should be pretty close to what you need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data mysample1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set mysample;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do year = year1 to year2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; drop year1 year2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that's not it, perhaps you could explain a little more about what you are looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 21:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/How-to-create-year-series/m-p/167724#M1871</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-10-02T21:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to create year series?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/How-to-create-year-series/m-p/167725#M1872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah astounding you beat me right to it!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also think what you are asking for is exactly accomplished by Astounding... I actually came to the exact same solution, a little late tho.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 22:15:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/How-to-create-year-series/m-p/167725#M1872</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2014-10-02T22:15:04Z</dc:date>
    </item>
  </channel>
</rss>

