<?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: OBS AND OUTOBS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/OBS-AND-OUTOBS/m-p/446131#M283120</link>
    <description>&lt;P&gt;OBS can be a system option or a dataset option, it limits the number of observarions &lt;EM&gt;read&lt;/EM&gt; in a proc or a datastep. OBS normally&amp;nbsp;decides the number of the last observation read. If, however, you have tables with "holes" in them (deleted observations), the results can vary a bit.&lt;/P&gt;&lt;P&gt;Look at this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
  do i=1 to 10;
    output;
    end;
run;

proc sql; /* delete the first observation */
  delete from x where i=1;
quit;

options obs=5;
data y;
  set x;
run;

data z;
  set x(firstobs=3);
run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The Y table contains 5 observations, which are i=2 to 6. Because the read started from the beginning, SAS new that an observation was deleted, and adjusted the number to read accordingly.&lt;/P&gt;&lt;P&gt;But the Z table contains 3 observations (as expected), with I values from 3 to 5 (not as expected), because SAS did not read from the start of the table (because of the FIRSTOBS option)&amp;nbsp;,and therefore did not realize that the first observation was deleted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The OUTOBS option is ony used in PROC SQL. It can used either in the SQL invocation ("proc SQL OUTOBS=&amp;lt;number&amp;gt;;") or in a RESET Statement. It does not limit the amount of processing done, except that processing stops once&amp;nbsp;the desired number of&amp;nbsp;observations has been output in the statement.&lt;/P&gt;&lt;P&gt;Compare this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options obs=1;
proc sql;
  select sum(age) from sashelp.class;
quit;
options obs=max;
proc sql outobs=1;
  select sum(age) from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The first PROC SQL call will return 14, which is the age of the first person in the dataset (only one record is read). The second SQL call will give you 253, which is the sum of all the ages in the class (OUTOBS does nothing here, as only one sum is to be returned anyway, all the records are read).&lt;/P&gt;</description>
    <pubDate>Fri, 16 Mar 2018 12:38:28 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2018-03-16T12:38:28Z</dc:date>
    <item>
      <title>OBS AND OUTOBS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OBS-AND-OUTOBS/m-p/445459#M283116</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to know the difference between obs and outobs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2018 12:51:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OBS-AND-OUTOBS/m-p/445459#M283116</guid>
      <dc:creator>katariasarthak</dc:creator>
      <dc:date>2018-03-14T12:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: OBS AND OUTOBS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OBS-AND-OUTOBS/m-p/445460#M283117</link>
      <description>&lt;P&gt;Please provide some context for this question.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2018 12:52:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OBS-AND-OUTOBS/m-p/445460#M283117</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-03-14T12:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: OBS AND OUTOBS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OBS-AND-OUTOBS/m-p/445462#M283118</link>
      <description>&lt;P&gt;Thats very vague, I mean the difference could be that the first has three less characters?&amp;nbsp; Have you read the manual for these items in relevance to where/how you are using them.&amp;nbsp; For instance:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ledsoptsref/69751/HTML/default/viewer.htm#p0h5nwbig8mobbn1u0dwtdo0c0a0.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/ledsoptsref/69751/HTML/default/viewer.htm#p0h5nwbig8mobbn1u0dwtdo0c0a0.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And for outobs:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi23/Handson/p130.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi23/Handson/p130.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2018 12:55:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OBS-AND-OUTOBS/m-p/445462#M283118</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-03-14T12:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: OBS AND OUTOBS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OBS-AND-OUTOBS/m-p/445464#M283119</link>
      <description>&lt;P&gt;Maxim 6: Google is your friend.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do a google search each for&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sas outobs&lt;/P&gt;
&lt;P&gt;sas obs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and you'll have enough information that will show you the answer.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2018 12:59:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OBS-AND-OUTOBS/m-p/445464#M283119</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-14T12:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: OBS AND OUTOBS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OBS-AND-OUTOBS/m-p/446131#M283120</link>
      <description>&lt;P&gt;OBS can be a system option or a dataset option, it limits the number of observarions &lt;EM&gt;read&lt;/EM&gt; in a proc or a datastep. OBS normally&amp;nbsp;decides the number of the last observation read. If, however, you have tables with "holes" in them (deleted observations), the results can vary a bit.&lt;/P&gt;&lt;P&gt;Look at this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
  do i=1 to 10;
    output;
    end;
run;

proc sql; /* delete the first observation */
  delete from x where i=1;
quit;

options obs=5;
data y;
  set x;
run;

data z;
  set x(firstobs=3);
run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The Y table contains 5 observations, which are i=2 to 6. Because the read started from the beginning, SAS new that an observation was deleted, and adjusted the number to read accordingly.&lt;/P&gt;&lt;P&gt;But the Z table contains 3 observations (as expected), with I values from 3 to 5 (not as expected), because SAS did not read from the start of the table (because of the FIRSTOBS option)&amp;nbsp;,and therefore did not realize that the first observation was deleted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The OUTOBS option is ony used in PROC SQL. It can used either in the SQL invocation ("proc SQL OUTOBS=&amp;lt;number&amp;gt;;") or in a RESET Statement. It does not limit the amount of processing done, except that processing stops once&amp;nbsp;the desired number of&amp;nbsp;observations has been output in the statement.&lt;/P&gt;&lt;P&gt;Compare this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options obs=1;
proc sql;
  select sum(age) from sashelp.class;
quit;
options obs=max;
proc sql outobs=1;
  select sum(age) from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The first PROC SQL call will return 14, which is the age of the first person in the dataset (only one record is read). The second SQL call will give you 253, which is the sum of all the ages in the class (OUTOBS does nothing here, as only one sum is to be returned anyway, all the records are read).&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 12:38:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OBS-AND-OUTOBS/m-p/446131#M283120</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2018-03-16T12:38:28Z</dc:date>
    </item>
  </channel>
</rss>

