<?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 create a table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-table/m-p/383976#M91619</link>
    <description>&lt;P&gt;OK, I really appreciate, thank you very much.&lt;/P&gt;</description>
    <pubDate>Sat, 29 Jul 2017 09:54:24 GMT</pubDate>
    <dc:creator>lixuan</dc:creator>
    <dc:date>2017-07-29T09:54:24Z</dc:date>
    <item>
      <title>How can I create a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-table/m-p/383858#M91592</link>
      <description>&lt;DIV class="lia-message-heading lia-component-message-header"&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-standard"&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-20 lia-quilt-column-left"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-left"&gt;&lt;DIV class="lia-message-subject"&gt;&lt;FONT size="3"&gt;Hi , &amp;nbsp;I have a dataset like following and &amp;nbsp;I want &amp;nbsp;the variable yymm &amp;nbsp;to be in &amp;nbsp;4 quarters (one year) before &amp;nbsp;the variable yymm_e so I can &amp;nbsp;complete my missing data of variable roe. &amp;nbsp;How can I do ? &amp;nbsp;thanks a lot.&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-message-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;DIV class="lia-message-heading lia-component-message-header"&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-standard"&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-20 lia-quilt-column-left"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-left"&gt;&lt;DIV class="lia-message-subject"&gt;&lt;DIV class="dropdown-positioning"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-message-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;PRE class="  language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; have&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;informat&lt;/SPAN&gt; company &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;15&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; roe &lt;SPAN class="token number"&gt;4.3&lt;/SPAN&gt; yymm yymm_e yymmn6&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;format&lt;/SPAN&gt; yymm yymm_e yymmn6&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; company&lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;  roe yymm  yymm_e &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;a &lt;SPAN class="token number"&gt;0.05&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;198503&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;198603&lt;/SPAN&gt;
a &lt;SPAN class="token number"&gt;0.03&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;198512&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;198603&lt;/SPAN&gt;
a &lt;SPAN class="token number"&gt;0.3&lt;/SPAN&gt;  &lt;SPAN class="token number"&gt;198606&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;198703&lt;/SPAN&gt;
b &lt;SPAN class="token number"&gt;0.4&lt;/SPAN&gt;  &lt;SPAN class="token number"&gt;198812&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;198902&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;The table structure I want should be as following .&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline"&gt;&lt;SPAN class="lia-message-image-wrapper"&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/14180i037D069B45610B0F/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="擷取.PNG" title="擷取.PNG" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 28 Jul 2017 18:50:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-table/m-p/383858#M91592</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-28T18:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-table/m-p/383869#M91598</link>
      <description>&lt;P&gt;I am waiting on line, pls help me! Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2017 19:08:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-table/m-p/383869#M91598</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-28T19:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-table/m-p/383880#M91601</link>
      <description>&lt;P&gt;Your start data is not the same as your last question. It appears as if for every record, you take the year, ignore the month portion and you create a record for every quarter for that year. This is my assumption of the logic, it does help if you can clearly state that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Logic:&lt;/P&gt;
&lt;P&gt;1. Take year for each record.&lt;/P&gt;
&lt;P&gt;2. Loop through and create new quarters for each record&lt;/P&gt;
&lt;P&gt;3. Output data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The logic previously should be enough to get you started and the answer is below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;data have;&lt;BR /&gt; informat company $15. roe 4.3 yymm yymm_e yymmn6.;&lt;BR /&gt; format yymm yymm_e yymmn6.;&lt;BR /&gt; input company$ roe yymm yymm_e;&lt;BR /&gt; cards;&lt;BR /&gt;a 0.05 198503 198603&lt;BR /&gt;a 0.3 198606 198703&lt;BR /&gt;b 0.4 198812 198902&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data skeleton_all;&lt;BR /&gt; set have;&lt;BR /&gt; *set date to beginning of year;&lt;BR /&gt; start_date=intnx('year', yymm, 0, 'b');&lt;BR /&gt;&lt;BR /&gt; *Loop through to get 4 quarters per year;&lt;BR /&gt; do i=0 to 3;&lt;BR /&gt; date=intnx('qtr', start_date, i, 'e');&lt;BR /&gt; format date yymmn6.;&lt;BR /&gt; output; *output a new record;&lt;BR /&gt; end;&lt;BR /&gt;&lt;BR /&gt; format start_date yymmn6.;&lt;BR /&gt; keep company date yymm yymm_e date;&lt;BR /&gt;run;&lt;/LI-SPOILER&gt;</description>
      <pubDate>Fri, 28 Jul 2017 19:26:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-table/m-p/383880#M91601</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-28T19:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-table/m-p/383905#M91605</link>
      <description>&lt;P&gt;Hi reeza , Thank you ver much . I did it in my last thread as you had taught, but i forgot set start-date. I have another question. In your code the start_time was the following, why can't I write 'start_time=yymm'?&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;start_date=intnx('year', yymm, 0, 'b');&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jul 2017 19:56:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-table/m-p/383905#M91605</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-28T19:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-table/m-p/383927#M91608</link>
      <description>&lt;P&gt;Because it's not the start date of the year. You need to create a record for every quarter of the year. If you start at the date you have it's sometimes halfway through the year. Again, I'm making assumptions on what you've provided. The logic is ultimately yours.&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/132979"&gt;@lixuan&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi reeza , Thank you ver much . I did it in my last thread as you had taught, but i forgot set start-date. I have another question. In your code the start_time was the following, why can't I write 'start_time=yymm'?&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;start_date=intnx('year', yymm, 0, 'b');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2017 20:51:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-table/m-p/383927#M91608</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-28T20:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-table/m-p/383976#M91619</link>
      <description>&lt;P&gt;OK, I really appreciate, thank you very much.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jul 2017 09:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-table/m-p/383976#M91619</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-29T09:54:24Z</dc:date>
    </item>
  </channel>
</rss>

