<?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: proc sql view vs table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-view-vs-table/m-p/975285#M378076</link>
    <description>&lt;P&gt;Because CREATING a view definition neither inputs nor outputs any observations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try adding those options to the PROC SQL step that uses the view to actually access the data.&lt;/P&gt;
&lt;PRE&gt;1    proc sql;
2    create view A as
3    select * from sashelp.class;
NOTE: SQL view WORK.A has been defined.
4    quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.12 seconds
      cpu time            0.04 seconds


5
6    proc sql outobs=8 inobs=10 ;
7    select * from A;
NOTE: Writing HTML Body file: sashtml.htm
WARNING: Statement terminated early due to OUTOBS=8 option.
8    quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.60 seconds
      cpu time            0.10 seconds


9    proc sql;
10   create view A as
11   select * from sashelp.class;
NOTE: SQL view WORK.A has been defined.
12   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


13
14   proc sql outobs=10 inobs=8 ;
15   select * from A;
WARNING: Only 8 records were read from SASHELP.CLASS due to INOBS= option.
16   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;</description>
    <pubDate>Wed, 17 Sep 2025 20:02:18 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2025-09-17T20:02:18Z</dc:date>
    <item>
      <title>proc sql view vs table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-view-vs-table/m-p/975194#M378057</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I tried the following codes:&lt;/P&gt;&lt;P&gt;proc sql outobs=8;&lt;BR /&gt;create view A as&lt;BR /&gt;select *&amp;nbsp;from sashelp.class;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;and&amp;nbsp;&lt;BR /&gt;proc sql inobs=8;&lt;BR /&gt;create view B as&amp;nbsp;&lt;/P&gt;&lt;P&gt;select *&amp;nbsp;from sashelp.class;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For both of them the condition&amp;nbsp;outobs=8 or&amp;nbsp;inobs=8 does not work. If I change view into table, either of them works. Why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Qinghe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2025 01:01:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-view-vs-table/m-p/975194#M378057</guid>
      <dc:creator>qinghe</dc:creator>
      <dc:date>2025-09-17T01:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql view vs table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-view-vs-table/m-p/975201#M378061</link>
      <description>&lt;P&gt;First thought: looks like a bug.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second thought: it is logical that the option is ignored.&lt;/P&gt;
&lt;P&gt;The options inobs and outobs are processed during the execution of proc sql, but are not included in the code of the created views. The contents of a view is created on accessing the view. Should be noted in the documentation, though.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2025 05:27:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-view-vs-table/m-p/975201#M378061</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2025-09-17T05:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql view vs table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-view-vs-table/m-p/975232#M378068</link>
      <description>&lt;P&gt;Interesting, I suppose it's sort of like running:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options obs=10 ;
proc sql ;
create view A as
select * from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The view is defined based on the CREATE VIEW statement, it doesn't know about system options in effect, or even options on the PROC SQL statement, apparently.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A workaround is to add an obs= option to the dataset listed on the FROM clause:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
create view A as
select * from sashelp.class(obs=8);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2025 13:10:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-view-vs-table/m-p/975232#M378068</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-09-17T13:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql view vs table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-view-vs-table/m-p/975285#M378076</link>
      <description>&lt;P&gt;Because CREATING a view definition neither inputs nor outputs any observations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try adding those options to the PROC SQL step that uses the view to actually access the data.&lt;/P&gt;
&lt;PRE&gt;1    proc sql;
2    create view A as
3    select * from sashelp.class;
NOTE: SQL view WORK.A has been defined.
4    quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.12 seconds
      cpu time            0.04 seconds


5
6    proc sql outobs=8 inobs=10 ;
7    select * from A;
NOTE: Writing HTML Body file: sashtml.htm
WARNING: Statement terminated early due to OUTOBS=8 option.
8    quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.60 seconds
      cpu time            0.10 seconds


9    proc sql;
10   create view A as
11   select * from sashelp.class;
NOTE: SQL view WORK.A has been defined.
12   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


13
14   proc sql outobs=10 inobs=8 ;
15   select * from A;
WARNING: Only 8 records were read from SASHELP.CLASS due to INOBS= option.
16   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Sep 2025 20:02:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-view-vs-table/m-p/975285#M378076</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-09-17T20:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql view vs table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-view-vs-table/m-p/975300#M378084</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67872"&gt;@qinghe&lt;/a&gt;&amp;nbsp;, I think you have the right conclusion about the &lt;EM&gt;inobs=;&lt;/EM&gt; and &lt;EM&gt;outobs=;&lt;/EM&gt; in &lt;EM&gt;proc sql&lt;/EM&gt; step, that is, they do not work for table and views. From my experience I had the same conclusion, that is, &lt;EM&gt;inobs=;&lt;/EM&gt; and &lt;EM&gt;outobs=;&lt;/EM&gt; only work for the &lt;STRONG&gt;default output &lt;/STRONG&gt;of &lt;EM&gt;proc sql &lt;/EM&gt;step (when one does not ask &lt;EM&gt;proc sql&lt;/EM&gt; to create table or view). They work in the same&amp;nbsp; way&amp;nbsp; that the&amp;nbsp;&lt;EM&gt;(obs=;)&lt;/EM&gt; in &lt;EM&gt;proc print&lt;/EM&gt; step, that is, they do NOT change anything of the dataset (e.g., how many rows it has) but only determine how many rows the &lt;EM&gt;proc print&lt;/EM&gt; step print out in the result window.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If one would like to select, or keep only the first several rows of a table to produce a new table, other techniques should be applied, such as use &lt;EM&gt;if _n_=num&lt;/EM&gt; in a &lt;EM&gt;data step&lt;/EM&gt;, or, I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;'s suggestion, use &lt;EM&gt;(obs=num)&lt;/EM&gt; behind table name in &lt;EM&gt;proc sql&lt;/EM&gt; step.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2025 03:28:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-view-vs-table/m-p/975300#M378084</guid>
      <dc:creator>dxiao2017</dc:creator>
      <dc:date>2025-09-18T03:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql view vs table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-view-vs-table/m-p/975775#M378169</link>
      <description>&lt;P&gt;Hi today I somehow suddenly found that I had a wrong impression about &lt;EM&gt;outobs=num&lt;/EM&gt; in &lt;EM&gt;proc sql&lt;/EM&gt;, and found &lt;EM&gt;outobs=num&lt;/EM&gt; in fact works for &lt;EM&gt;create table&lt;/EM&gt;, the code and log are as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql outobs=3;
create table test as
select * from sashelp.class;
describe table test;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;69         proc sql outobs=3;
 70         create table test as
 71         select * from sashelp.class;
 WARNING: Statement terminated early due to OUTOBS=3 option.
 NOTE: &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Table WORK.TEST created, with 3 rows &lt;/STRONG&gt;&lt;/FONT&gt;and 5 columns.&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Sep 2025 10:14:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-view-vs-table/m-p/975775#M378169</guid>
      <dc:creator>dxiao2017</dc:creator>
      <dc:date>2025-09-26T10:14:55Z</dc:date>
    </item>
  </channel>
</rss>

