<?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: How can I expand a dataset into a panel? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-expand-a-dataset-into-a-panel/m-p/472835#M121279</link>
    <description>&lt;P&gt;You already have a data set with the list of ID values.&amp;nbsp; Create a similar data set with the list of YEAR values:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data year_list;&lt;/P&gt;
&lt;P&gt;do year = 2001 to 2003;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;output;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then SQL will give you all combinations:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;select * from id_list, year_list;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As was suggested earlier, you could just use a DATA step with your existing list of IDs.&amp;nbsp; If you really don't know SQL at this point, I'm not sure that this SQL solution is tremendously helpful.&amp;nbsp; It might be better to build upon what you already know.&lt;/P&gt;</description>
    <pubDate>Sun, 24 Jun 2018 23:13:38 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-06-24T23:13:38Z</dc:date>
    <item>
      <title>How can I expand a dataset into a panel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-expand-a-dataset-into-a-panel/m-p/472792#M121258</link>
      <description>&lt;P&gt;I have a dataset as follows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;variable: ID&lt;/P&gt;&lt;P&gt;obs1:&amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;&lt;P&gt;obs2:&amp;nbsp; &amp;nbsp; &amp;nbsp; B&lt;/P&gt;&lt;P&gt;obs3:&amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope to expand this dataset to a panel, where each ID corresponds to a time series:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;variable: ID&amp;nbsp; &amp;nbsp;year&lt;/P&gt;&lt;P&gt;obs1:&amp;nbsp; &amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; 2001&lt;/P&gt;&lt;P&gt;obs2:&amp;nbsp; &amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; 2002&lt;/P&gt;&lt;P&gt;obs3:&amp;nbsp; &amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; 2003&lt;/P&gt;&lt;P&gt;obs4:&amp;nbsp; &amp;nbsp; &amp;nbsp; B&amp;nbsp; &amp;nbsp; 2001&lt;/P&gt;&lt;P&gt;obs5:&amp;nbsp; &amp;nbsp; &amp;nbsp; B&amp;nbsp; &amp;nbsp; 2002&lt;/P&gt;&lt;P&gt;obs6:&amp;nbsp; &amp;nbsp; &amp;nbsp; B&amp;nbsp; &amp;nbsp; 2003&lt;/P&gt;&lt;P&gt;obs7:&amp;nbsp; &amp;nbsp; &amp;nbsp; C&amp;nbsp; &amp;nbsp; 2001&lt;/P&gt;&lt;P&gt;obs8:&amp;nbsp; &amp;nbsp; &amp;nbsp; C&amp;nbsp; &amp;nbsp; 2002&lt;/P&gt;&lt;P&gt;obs9:&amp;nbsp; &amp;nbsp; &amp;nbsp; C&amp;nbsp; &amp;nbsp; 2003&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which command can perform this expasion?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jun 2018 17:22:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-expand-a-dataset-into-a-panel/m-p/472792#M121258</guid>
      <dc:creator>xyxu</dc:creator>
      <dc:date>2018-06-24T17:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: How can I expand a dataset into a panel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-expand-a-dataset-into-a-panel/m-p/472798#M121260</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
do year = 2001 to 2003; /* create three observations for every obs in the input dataset */
  output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;Edit: added the data step around the do loop.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 08:27:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-expand-a-dataset-into-a-panel/m-p/472798#M121260</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-25T08:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: How can I expand a dataset into a panel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-expand-a-dataset-into-a-panel/m-p/472812#M121268</link>
      <description>&lt;P&gt;PROC TIMESERIES, PROC EXPAND can be used to prep time series data, but a manual data step or SQL join is just as efficient and simple for your use case.&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/99650"&gt;@xyxu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a dataset as follows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;variable: ID&lt;/P&gt;
&lt;P&gt;obs1:&amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;obs2:&amp;nbsp; &amp;nbsp; &amp;nbsp; B&lt;/P&gt;
&lt;P&gt;obs3:&amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope to expand this dataset to a panel, where each ID corresponds to a time series:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;variable: ID&amp;nbsp; &amp;nbsp;year&lt;/P&gt;
&lt;P&gt;obs1:&amp;nbsp; &amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; 2001&lt;/P&gt;
&lt;P&gt;obs2:&amp;nbsp; &amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; 2002&lt;/P&gt;
&lt;P&gt;obs3:&amp;nbsp; &amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; 2003&lt;/P&gt;
&lt;P&gt;obs4:&amp;nbsp; &amp;nbsp; &amp;nbsp; B&amp;nbsp; &amp;nbsp; 2001&lt;/P&gt;
&lt;P&gt;obs5:&amp;nbsp; &amp;nbsp; &amp;nbsp; B&amp;nbsp; &amp;nbsp; 2002&lt;/P&gt;
&lt;P&gt;obs6:&amp;nbsp; &amp;nbsp; &amp;nbsp; B&amp;nbsp; &amp;nbsp; 2003&lt;/P&gt;
&lt;P&gt;obs7:&amp;nbsp; &amp;nbsp; &amp;nbsp; C&amp;nbsp; &amp;nbsp; 2001&lt;/P&gt;
&lt;P&gt;obs8:&amp;nbsp; &amp;nbsp; &amp;nbsp; C&amp;nbsp; &amp;nbsp; 2002&lt;/P&gt;
&lt;P&gt;obs9:&amp;nbsp; &amp;nbsp; &amp;nbsp; C&amp;nbsp; &amp;nbsp; 2003&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which command can perform this expasion?&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>Sun, 24 Jun 2018 19:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-expand-a-dataset-into-a-panel/m-p/472812#M121268</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-24T19:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can I expand a dataset into a panel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-expand-a-dataset-into-a-panel/m-p/472823#M121273</link>
      <description>Could you provide a sample code of SQL join for this purpose? I am not familiar with SQL. Thanks!</description>
      <pubDate>Sun, 24 Jun 2018 20:33:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-expand-a-dataset-into-a-panel/m-p/472823#M121273</guid>
      <dc:creator>xyxu</dc:creator>
      <dc:date>2018-06-24T20:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: How can I expand a dataset into a panel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-expand-a-dataset-into-a-panel/m-p/472835#M121279</link>
      <description>&lt;P&gt;You already have a data set with the list of ID values.&amp;nbsp; Create a similar data set with the list of YEAR values:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data year_list;&lt;/P&gt;
&lt;P&gt;do year = 2001 to 2003;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;output;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then SQL will give you all combinations:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;select * from id_list, year_list;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As was suggested earlier, you could just use a DATA step with your existing list of IDs.&amp;nbsp; If you really don't know SQL at this point, I'm not sure that this SQL solution is tremendously helpful.&amp;nbsp; It might be better to build upon what you already know.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jun 2018 23:13:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-expand-a-dataset-into-a-panel/m-p/472835#M121279</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-24T23:13:38Z</dc:date>
    </item>
  </channel>
</rss>

