<?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: Extracting Data from a Table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-a-Table/m-p/769177#M244022</link>
    <description>&lt;P&gt;I would have expected that to work, what error did you get?&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/381436"&gt;@SasStatistics&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a SAS data set, let's call it &lt;STRONG&gt;MyDataTable&lt;/STRONG&gt;, of the following schematic form (it has like 10 millions rows so all months for the last 20 years are covered):&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;TABLE width="150"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;Observation&amp;nbsp;&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;Period&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;1&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201101&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;2&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201102&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;3&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201103&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;4&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201104&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;5&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201105&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;6&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201106&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;7&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201107&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;8&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201108&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;9&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201109&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;10&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201110&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;11&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201111&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;12&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201112&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The Period column has the format: $6.&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Now, I would &lt;STRONG&gt;dynamically&lt;/STRONG&gt; like to extract some observations each month in a table called &lt;STRONG&gt;MyDesiredData&lt;/STRONG&gt;. So for example:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Assuming now we stand in year 2011:&amp;nbsp;&lt;BR /&gt;In january I would like to extract observation 1 with period&amp;nbsp;201101&lt;/P&gt;
&lt;P&gt;In februari I would like to extract observation 2 with period&amp;nbsp;201102&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My try was something like:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data &lt;STRONG&gt;MyDesiredData&lt;/STRONG&gt;; 
	set &lt;STRONG&gt;MyDataTable&lt;/STRONG&gt;(where=(period=put(today(),yymn6.))); 
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any suggestions?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Sep 2021 14:32:55 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-09-22T14:32:55Z</dc:date>
    <item>
      <title>Extracting Data from a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-a-Table/m-p/769132#M243992</link>
      <description>&lt;P&gt;I have a SAS data set, let's call it &lt;STRONG&gt;MyDataTable&lt;/STRONG&gt;, of the following schematic form (it has like 10 millions rows so all months for the last 20 years are covered):&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;TABLE width="150"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;Observation&amp;nbsp;&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;Period&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;1&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201101&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;2&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201102&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;3&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201103&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;4&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201104&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;5&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201105&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;6&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201106&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;7&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201107&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;8&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201108&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;9&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201109&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;10&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201110&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;11&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201111&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;12&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201112&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The Period column has the format: $6.&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Now, I would &lt;STRONG&gt;dynamically&lt;/STRONG&gt; like to extract some observations each month in a table called &lt;STRONG&gt;MyDesiredData&lt;/STRONG&gt;. So for example:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Assuming now we stand in year 2011:&amp;nbsp;&lt;BR /&gt;In january I would like to extract observation 1 with period&amp;nbsp;201101&lt;/P&gt;
&lt;P&gt;In februari I would like to extract observation 2 with period&amp;nbsp;201102&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My try was something like:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data &lt;STRONG&gt;MyDesiredData&lt;/STRONG&gt;; 
	set &lt;STRONG&gt;MyDataTable&lt;/STRONG&gt;(where=(period=put(today(),yymn6.))); 
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any suggestions?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 12:42:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-a-Table/m-p/769132#M243992</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-09-22T12:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Data from a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-a-Table/m-p/769177#M244022</link>
      <description>&lt;P&gt;I would have expected that to work, what error did you get?&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/381436"&gt;@SasStatistics&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a SAS data set, let's call it &lt;STRONG&gt;MyDataTable&lt;/STRONG&gt;, of the following schematic form (it has like 10 millions rows so all months for the last 20 years are covered):&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;TABLE width="150"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;Observation&amp;nbsp;&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;Period&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;1&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201101&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;2&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201102&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;3&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201103&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;4&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201104&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;5&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201105&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;6&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201106&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;7&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201107&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;8&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201108&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;9&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201109&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;10&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201110&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;11&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201111&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="101.973px" height="29px"&gt;12&lt;/TD&gt;
&lt;TD width="63.457px" height="29px"&gt;201112&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The Period column has the format: $6.&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Now, I would &lt;STRONG&gt;dynamically&lt;/STRONG&gt; like to extract some observations each month in a table called &lt;STRONG&gt;MyDesiredData&lt;/STRONG&gt;. So for example:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Assuming now we stand in year 2011:&amp;nbsp;&lt;BR /&gt;In january I would like to extract observation 1 with period&amp;nbsp;201101&lt;/P&gt;
&lt;P&gt;In februari I would like to extract observation 2 with period&amp;nbsp;201102&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My try was something like:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data &lt;STRONG&gt;MyDesiredData&lt;/STRONG&gt;; 
	set &lt;STRONG&gt;MyDataTable&lt;/STRONG&gt;(where=(period=put(today(),yymn6.))); 
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any suggestions?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 14:32:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-a-Table/m-p/769177#M244022</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-09-22T14:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Data from a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-a-Table/m-p/769181#M244025</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data MyDesiredData; 
	set MyDataTable(where=(period=put(today(),yymn6.))); 
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_self"&gt;Maxim 2&lt;/A&gt;: Read the Log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given the code you have posted, the log should indicate the exact problem.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 14:53:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-a-Table/m-p/769181#M244025</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-09-22T14:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Data from a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-a-Table/m-p/769188#M244030</link>
      <description>I used the reply you posted before, why did you remove it? Wanted to accept the answer.</description>
      <pubDate>Wed, 22 Sep 2021 14:55:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-a-Table/m-p/769188#M244030</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-09-22T14:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Data from a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-a-Table/m-p/769191#M244031</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381436"&gt;@SasStatistics&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I used the reply you posted before, why did you remove it? Wanted to accept the answer.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There are better answers ... as I said, read the log, then figure out what the problem is ... the log is very clear.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 15:07:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-a-Table/m-p/769191#M244031</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-09-22T15:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Data from a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-a-Table/m-p/769192#M244032</link>
      <description>&lt;P&gt;Your original code should have worked, the other answer is actually not the preferred method, your code is the preferred method.&lt;BR /&gt;So what error did you get with the original code?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 15:03:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-a-Table/m-p/769192#M244032</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-09-22T15:03:12Z</dc:date>
    </item>
  </channel>
</rss>

