<?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: FIRSTOBS=MAX Warning in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322349#M71315</link>
    <description>&lt;P&gt;Thanks, thats exactly what I thought first, especcially because I read somewhere else, that this would be an error in sas 9.1 or so.&lt;BR /&gt;But most probably it was the same misunderstanding , should read&lt;/P&gt;
&lt;H4 class="xis-argument"&gt;MAX&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;sets the number of the first observation to process to the maximum &lt;EM&gt;&amp;lt;POSSIBLE&amp;gt;&lt;/EM&gt; number of observations in the data set.&lt;/P&gt;
&lt;P class="xis-paraSimpleFirst"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xis-paraSimpleFirst"&gt;Thank you all for your thoughts!&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Wed, 04 Jan 2017 07:56:57 GMT</pubDate>
    <dc:creator>UliS</dc:creator>
    <dc:date>2017-01-04T07:56:57Z</dc:date>
    <item>
      <title>FIRSTOBS=MAX Warning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322156#M71257</link>
      <description>&lt;P&gt;Hi, all,&lt;/P&gt;
&lt;P&gt;I tried to get the last observation of a sas data set by the simple data set option "FIRSTOBS=MAX", and it never works. Has someone an idea, whats wrong with that? (SAS 9.4)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Sample code:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;data test; input var1;&lt;BR /&gt;datalines;&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;BR /&gt;data test; set test(firstobs=max); run;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Log:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;WARNING: FIRSTOBS option &amp;gt; number of observations in WORK.TEST.&lt;/EM&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can MAX be greater than no of observations, if MAX is number of observations?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 15:15:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322156#M71257</guid>
      <dc:creator>UliS</dc:creator>
      <dc:date>2017-01-03T15:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTOBS=MAX Warning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322159#M71258</link>
      <description>&lt;P&gt;MAX is an option for OBS, but not for FIRSTOBS.&amp;nbsp; If you want to retrieve the last observation from a data set, you can use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have nobs=_nobs_ point=_nobs_;&lt;/P&gt;
&lt;P&gt;output;&lt;/P&gt;
&lt;P&gt;stop;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't forget the STOP statement, or you will have created an infinite loop.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 15:20:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322159#M71258</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-01-03T15:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTOBS=MAX Warning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322160#M71259</link>
      <description>&lt;P&gt;Please post the full log.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 15:20:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322160#M71259</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-03T15:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTOBS=MAX Warning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322161#M71260</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;The docs state that MAX is valid in 9.4 at least.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ledsoptsref/69751/HTML/default/viewer.htm#p0wjxoxrco6dsgn1ls5n3mbybcng.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/ledsoptsref/69751/HTML/default/viewer.htm#p0wjxoxrco6dsgn1ls5n3mbybcng.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 15:22:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322161#M71260</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-03T15:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTOBS=MAX Warning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322162#M71261</link>
      <description>&lt;P&gt;&lt;STRONG&gt;The full log is&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;42911&amp;nbsp;&amp;nbsp; data test; input var1;&lt;BR /&gt;42912&amp;nbsp;&amp;nbsp; datalines;&lt;BR /&gt;&lt;BR /&gt;NOTE: The data set WORK.TEST has 4 observations and 1 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;42917&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;42918&amp;nbsp;&amp;nbsp; RUN;&lt;BR /&gt;42919&amp;nbsp;&amp;nbsp; data test; set test(firstobs=max); run;&lt;BR /&gt;&lt;STRONG&gt;WARNING: FIRSTOBS option &amp;gt; number of observations in WORK.TEST.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;NOTE: There were 0 observations read from the data set WORK.TEST.&lt;/STRONG&gt;&lt;BR /&gt;NOTE: The data set WORK.TEST has 0 observations and 1 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 15:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322162#M71261</guid>
      <dc:creator>UliS</dc:creator>
      <dc:date>2017-01-03T15:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTOBS=MAX Warning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322165#M71262</link>
      <description>MAX is a valid value for FIRSTOBS according SAS documentation, see &lt;A href="http://support.sas.com/documentation/cdl/en/ledsoptsref/69751/HTML/default/viewer.htm#p0wjxoxrco6dsgn1ls5n3mbybcng.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/ledsoptsref/69751/HTML/default/viewer.htm#p0wjxoxrco6dsgn1ls5n3mbybcng.htm&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;Of course there are a lot of work arounds, but I intend to write a macro for several users, so the code should be as simple and understandable as possible.</description>
      <pubDate>Tue, 03 Jan 2017 15:26:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322165#M71262</guid>
      <dc:creator>UliS</dc:creator>
      <dc:date>2017-01-03T15:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTOBS=MAX Warning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322171#M71263</link>
      <description>&lt;P&gt;Try using a different data set name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What happens with following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data want;&lt;/P&gt;
&lt;P&gt;set SASHELP.class (firstobs=max);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 15:32:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322171#M71263</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-03T15:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTOBS=MAX Warning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322172#M71264</link>
      <description>&lt;P&gt;What are you attempting to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you are getting 0 observations in your output you need to describe what the expected output is. Note: the max option isn't going to give you the last observation unless it happens to be about the 9.2 quintillionth if I read MAX as the firstobs option correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that for your given example you will get the same result for firstobs=100 &amp;gt; you have asked for an observation whose number exceeds the number of the data set observations.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 15:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322172#M71264</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-03T15:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTOBS=MAX Warning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322180#M71265</link>
      <description>&lt;P&gt;THANKS,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;got my mistake.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MAX is NOT the number of observations in the current data set, BUT the &lt;STRONG&gt;maximal possible&lt;/STRONG&gt; number of observations in any data set!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I will work around that, its a pity, would have been so nice and short.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 15:51:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322180#M71265</guid>
      <dc:creator>UliS</dc:creator>
      <dc:date>2017-01-03T15:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTOBS=MAX Warning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322184#M71267</link>
      <description>&lt;P&gt;Please look at this code:&lt;/P&gt;
&lt;PRE&gt;proc sql noprint;
   select nobs into : num
   from dictionary.tables
   where libname='SASHELP' and memname='CLASS';
quit;

data junk;
   set sashelp.class (firstobs=&amp;amp;num);
run;&lt;/PRE&gt;
&lt;P&gt;In the Dictionary table the library name and memname are uppercase by default. If you are 100 percent sure that the only memname (dataset) of a given name only occurs one time you could skip the libname but I strongly recommend using it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The dictionary tables (or views in the SASHELP library) contain all the information that SAS knows about your data sets and variables. Very much worth looking into for automation based on information about them.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 16:09:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322184#M71267</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-03T16:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTOBS=MAX Warning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322243#M71281</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Note: the max option isn't going to give you the last observation unless it happens to be about the 9.2 quintillionth if I read MAX as the firstobs option correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's not how I read it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4 class="xis-argument"&gt;MAX&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;sets the number of the first observation to process to the maximum number of observations in the data set.&lt;/P&gt;
&lt;P class="xis-paraSimpleFirst"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xis-paraSimpleFirst"&gt;I can see how the interpretation can go both ways, but my initial expectation would align with what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15745"&gt;@UliS&lt;/a&gt;&amp;nbsp;was expecting.&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 Jan 2017 20:42:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322243#M71281</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-03T20:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTOBS=MAX Warning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322347#M71313</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;fine.&lt;/P&gt;
&lt;P&gt;There are several work-arounds, e.g.&lt;/P&gt;
&lt;P&gt;data test; set test; x=1; run;&lt;/P&gt;
&lt;P&gt;data test(drop=x); set test; by x; if last.x; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just loved the idea to make it simple and did not see my misunderstanding...&lt;/P&gt;
&lt;P&gt;Best Uli&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 07:53:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322347#M71313</guid>
      <dc:creator>UliS</dc:creator>
      <dc:date>2017-01-04T07:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTOBS=MAX Warning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322349#M71315</link>
      <description>&lt;P&gt;Thanks, thats exactly what I thought first, especcially because I read somewhere else, that this would be an error in sas 9.1 or so.&lt;BR /&gt;But most probably it was the same misunderstanding , should read&lt;/P&gt;
&lt;H4 class="xis-argument"&gt;MAX&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;sets the number of the first observation to process to the maximum &lt;EM&gt;&amp;lt;POSSIBLE&amp;gt;&lt;/EM&gt; number of observations in the data set.&lt;/P&gt;
&lt;P class="xis-paraSimpleFirst"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xis-paraSimpleFirst"&gt;Thank you all for your thoughts!&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 04 Jan 2017 07:56:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FIRSTOBS-MAX-Warning/m-p/322349#M71315</guid>
      <dc:creator>UliS</dc:creator>
      <dc:date>2017-01-04T07:56:57Z</dc:date>
    </item>
  </channel>
</rss>

