<?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: In PROC SQL what is the difference between inobs and outobs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877751#M346747</link>
    <description>&lt;P&gt;Somehow I was not clear with INOBS. I thank everyone for clarifying it.&lt;/P&gt;</description>
    <pubDate>Fri, 26 May 2023 18:12:50 GMT</pubDate>
    <dc:creator>Moksha</dc:creator>
    <dc:date>2023-05-26T18:12:50Z</dc:date>
    <item>
      <title>In PROC SQL what is the difference between inobs and outobs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877651#M346704</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I have been trying to understand the difference between inobs and outobs, but it's not clear to me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have referred to the earlier post on this forum at:&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Difference-between-in-inobs-and-outobs/m-p/419910#M103290" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Difference-between-in-inobs-and-outobs/m-p/419910#M103290&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and executed the example given by Reeza. In this example, we run the code with outobs = 2 first and the result contains 2 records where age is 16 and 15 and after this if we run the code with inobs =2 then the result contains 2 records where age is 14 and 13.&lt;/P&gt;&lt;P&gt;I didn't understand why inobs result is different from outobs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I have gone through the documentation on SAS site:&lt;/P&gt;&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/n0a693shdq473qn1svlwshfci9rg.htm#n0pz0czrns2pksn1im05lnw36t98" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/n0a693shdq473qn1svlwshfci9rg.htm#n0pz0czrns2pksn1im05lnw36t98&lt;/A&gt;&lt;/P&gt;&lt;P&gt;but, I am not clear on the differences between the two.&lt;/P&gt;&lt;P&gt;Can anyone help me to understand the differences between the two, giving some examples?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 08:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877651#M346704</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-05-26T08:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: In PROC SQL what is the difference between inobs and outobs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877653#M346705</link>
      <description>Please have a look at this thread: &lt;A href="https://communities.sas.com/t5/SAS-Programming/Difference-between-in-inobs-and-outobs/td-p/419910" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Difference-between-in-inobs-and-outobs/td-p/419910&lt;/A&gt;</description>
      <pubDate>Fri, 26 May 2023 08:59:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877653#M346705</guid>
      <dc:creator>JosvanderVelden</dc:creator>
      <dc:date>2023-05-26T08:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: In PROC SQL what is the difference between inobs and outobs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877664#M346709</link>
      <description>&lt;P&gt;Thank you for the reply. I have already gone through this thread (I have mentioned the same post in my query), but it's not clear to me. Can you please provide few more examples explaining the differences?&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 10:10:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877664#M346709</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-05-26T10:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: In PROC SQL what is the difference between inobs and outobs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877669#M346710</link>
      <description>&lt;P&gt;I think the documentation is clear. I have highlighted the differences:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class="xisDoc-paragraph"&gt;The INOBS= option &lt;FONT color="#FF0000"&gt;restricts the number of rows that PROC SQL takes as input from any single source.&lt;/FONT&gt; For example, if you specify INOBS=10, then PROC SQL uses only 10 rows from any table or view that is specified in a FROM clause. If you specify INOBS=10 and join two tables without using a WHERE clause, then the resulting table (Cartesian product) contains a maximum of 100 rows. The INOBS= option is similar to the SAS system option OBS=.&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;The OUTOBS= option &lt;FONT color="#FF0000"&gt;restricts the number of rows that PROC SQL displays or writes to a table&lt;/FONT&gt;. For example, if you specify OUTOBS=10 and insert values into a table by using a query, then PROC SQL inserts a maximum of 10 rows into the resulting table. OUTOBS= is similar to the SAS data set option OBS=.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 10:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877669#M346710</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-05-26T10:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: In PROC SQL what is the difference between inobs and outobs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877696#M346728</link>
      <description>&lt;P&gt;Thank you for the explanation. As per this, the following code with INOBS=5 should result in 5 records with age is 16, 15, 14, 13 and 12. But, it is resulting in only 2 records with age 14 and 13. I am not able to understand this.&amp;nbsp; But, the code with OUTOBS=5 gives 5 records. Hence, not able to understand why INOBS is resulting in only 2 records when it is specified that INOBS=5. Can you please clarify?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Code:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;U&gt;title 'InObs demo';&lt;BR /&gt;proc sql &lt;STRONG&gt;inobs=5;&lt;/STRONG&gt;&lt;BR /&gt;select age, count(*)&lt;BR /&gt;from sashelp.class&lt;BR /&gt;group by age&lt;BR /&gt;order by age desc;&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/U&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;&lt;U&gt;Output:&lt;/U&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;TABLE border="0" cellspacing="1" cellpadding="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;InObs demo&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;Age &amp;nbsp; &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P class="lia-align-left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-left"&gt;&lt;STRONG&gt;&lt;FONT color="#000080"&gt;But, the following code with OUTOBS=5 results in 5 records with ages 16, 15, 14, 13, 12:&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="lia-align-left"&gt;&lt;U&gt;&lt;STRONG&gt;Code:&lt;/STRONG&gt;&lt;/U&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-left"&gt;&lt;FONT color="#0000FF"&gt;title 'OutObs demo';&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;proc sql outobs=5;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;select age, count(*)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;from sashelp.class&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;group by age&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;order by age desc;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-left"&gt;&lt;U&gt;&lt;STRONG&gt;Here is the result of this code:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;TABLE border="0" cellspacing="1" cellpadding="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;OutObs demo&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;Age &amp;nbsp; &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;16&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 26 May 2023 14:36:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877696#M346728</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-05-26T14:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: In PROC SQL what is the difference between inobs and outobs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877699#M346729</link>
      <description>&lt;P&gt;Your print out shows that it did that what you asked.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the first one there were 3 observations with AGE=14 and 2 with AGE=13 for a total of 5 observations read IN.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the second one it wrote out five observations.&amp;nbsp; It had to read in 17 observations to find the 5 different values of AGE that it wrote OUT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 14:56:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877699#M346729</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-26T14:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: In PROC SQL what is the difference between inobs and outobs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877703#M346730</link>
      <description>&lt;P&gt;Just look at the first 5 observations in sashelp.class and the age values you find there.&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 15:07:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877703#M346730</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-05-26T15:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: In PROC SQL what is the difference between inobs and outobs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877749#M346745</link>
      <description>&lt;P&gt;Thank you very much for the clear explanation. Now. I understand how to interpret the output from INOBS and OUTOBS.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 18:04:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877749#M346745</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-05-26T18:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: In PROC SQL what is the difference between inobs and outobs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877750#M346746</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/439180"&gt;@Moksha&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for the explanation. As per this, the following code with INOBS=5 should result in 5 records with age is 16, 15, 14, 13 and 12. &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't see how you come to this understanding based upon the words in the documentation. It is taking 5 records, regardless of age.&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 18:07:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877750#M346746</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-05-26T18:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: In PROC SQL what is the difference between inobs and outobs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877751#M346747</link>
      <description>&lt;P&gt;Somehow I was not clear with INOBS. I thank everyone for clarifying it.&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 18:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-PROC-SQL-what-is-the-difference-between-inobs-and-outobs/m-p/877751#M346747</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-05-26T18:12:50Z</dc:date>
    </item>
  </channel>
</rss>

