<?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: WARNING: FIRSTOBS option &amp;gt; number of observations in WORK.CLASS. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/WARNING-FIRSTOBS-option-gt-number-of-observations-in-WORK-CLASS/m-p/408336#M99642</link>
    <description>&lt;PRE&gt;
John King, 
Can you add one more obs at the end of CLASS ?


data class;
   set sashelp.class (obs=1);
run;

data copy_class;
 set class(keep=name) end=last;
 output;
 if last then do;
  call missing(name);
  output;
 end;
run;

data next;
   set class end=eof;
   if not eof then set copy_class(firstobs=2 keep=name rename=name=nextname);
   output;
   call missing(nextname);
   run;


&lt;/PRE&gt;</description>
    <pubDate>Sun, 29 Oct 2017 12:46:03 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2017-10-29T12:46:03Z</dc:date>
    <item>
      <title>WARNING: FIRSTOBS option &gt; number of observations in WORK.CLASS.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-FIRSTOBS-option-gt-number-of-observations-in-WORK-CLASS/m-p/408086#M99520</link>
      <description>&lt;P&gt;I'm doing a typical look ahead read when the input data has only one observation I get the WARNING:.&amp;nbsp; My program still works I just don't want to be warned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
   set sashelp.class;
   output;
   stop;
   run;

data next;
   set class end=eof;
   if not eof then set class(firstobs=2 keep=name rename=name=nextname);
   output;
   call missing(nextname);
   run;
proc print;
   run;&lt;/CODE&gt;&lt;/PRE&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;PRE&gt;34         data next;
35            set class end=eof;
36            if not eof then set class(firstobs=2 keep=name rename=name=nextname);
WARNING: FIRSTOBS option &amp;gt; number of observations in WORK.CLASS.
37            output;
38            call missing(nextname);
39            run;

NOTE: There were 1 observations read from the data set WORK.CLASS.
NOTE: The data set WORK.NEXT has 1 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Oct 2017 15:31:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-FIRSTOBS-option-gt-number-of-observations-in-WORK-CLASS/m-p/408086#M99520</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2017-10-27T15:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: FIRSTOBS option &gt; number of observations in WORK.CLASS.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-FIRSTOBS-option-gt-number-of-observations-in-WORK-CLASS/m-p/408119#M99534</link>
      <description>&lt;P&gt;I don't know of any option to suppress that warning.&lt;/P&gt;
&lt;P&gt;You could perhaps use a view to create the look_ahead data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
   set sashelp.class (obs=1);
run;

data look_ahead / view=look_ahead;
  set class ;
  if _n_ &amp;gt; 1;
  keep=name;
  rename name=nextname;
run;

data next;
   set class end=eof ;
   if not eof then set look_ahead ;
   output;
   call missing(nextname);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or if it doesn't mess up other things (like FIRST. processing) you could just read the first observation twice and throw away the extra one.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data next;
   set class(obs=1) class end=eof;
   if not eof then set class(keep=name rename=(name=nextname));
   if _n_ &amp;gt; 1 then output;
   call missing(nextname);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 19:38:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-FIRSTOBS-option-gt-number-of-observations-in-WORK-CLASS/m-p/408119#M99534</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-10-27T19:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: FIRSTOBS option &gt; number of observations in WORK.CLASS.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-FIRSTOBS-option-gt-number-of-observations-in-WORK-CLASS/m-p/408139#M99541</link>
      <description>&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/159"&gt;@Tom&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I don't know of any option to suppress that warning.&lt;/P&gt;
&lt;P&gt;You could perhaps use a view to create the look_ahead data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
   set sashelp.class (obs=1);
run;

data look_ahead / view=look_ahead;
  set class ;
  if _n_ &amp;gt; 1;
  keep=name;
  rename name=nextname;
run;

data next;
   set class end=eof ;
   if not eof then set look_ahead ;
   output;
   call missing(nextname);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or if it doesn't mess up other things (like FIRST. processing) you could just read the first observation twice and through away the extra one.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data next;
   set class(obs=1) class end=eof;
   if not eof then set class(keep=name rename=(name=nextname));
   if _n_ &amp;gt; 1 then output;
   call missing(nextname);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Thanks Tom, excellent use of view and turning the problem around. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 19:31:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-FIRSTOBS-option-gt-number-of-observations-in-WORK-CLASS/m-p/408139#M99541</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2017-10-27T19:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: FIRSTOBS option &gt; number of observations in WORK.CLASS.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-FIRSTOBS-option-gt-number-of-observations-in-WORK-CLASS/m-p/408336#M99642</link>
      <description>&lt;PRE&gt;
John King, 
Can you add one more obs at the end of CLASS ?


data class;
   set sashelp.class (obs=1);
run;

data copy_class;
 set class(keep=name) end=last;
 output;
 if last then do;
  call missing(name);
  output;
 end;
run;

data next;
   set class end=eof;
   if not eof then set copy_class(firstobs=2 keep=name rename=name=nextname);
   output;
   call missing(nextname);
   run;


&lt;/PRE&gt;</description>
      <pubDate>Sun, 29 Oct 2017 12:46:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-FIRSTOBS-option-gt-number-of-observations-in-WORK-CLASS/m-p/408336#M99642</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-10-29T12:46:03Z</dc:date>
    </item>
  </channel>
</rss>

