<?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: Inconsistent results by SQLOBS depending on NOPRINT option in PROC SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556165#M154904</link>
    <description>&lt;P&gt;using the following code to replace.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL ;

create table _null_ as 

SELECT *
FROM CarVars;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 04 May 2019 11:29:26 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2019-05-04T11:29:26Z</dc:date>
    <item>
      <title>Inconsistent results by SQLOBS depending on NOPRINT option in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556081#M154858</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I came across SQLOBS and tried some codes but the returns are inconsistent (from the logs).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC CONTENTS DATA=SASHELP.cars&lt;BR /&gt;OUT=CarVars&lt;BR /&gt;NOPRINT;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL NOPRINT;&lt;BR /&gt;SELECT *&lt;BR /&gt;FROM CarVars;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;%PUT &amp;amp;=SQLOBS;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasSource"&gt;Above code shows from the log:&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;DIV class="sasSource"&gt;83 %PUT &amp;amp;=SQLOBS;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;SQLOBS=1&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;If however I remove the NOPRINT option from the proc sql, I get a different result, one that I expect the NOPRINT option should return&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;PROC SQL;&lt;BR /&gt;SELECT *&lt;BR /&gt;FROM CarVars;&lt;BR /&gt;QUIT;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;shows the ff from the log:&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;DIV class="sasSource"&gt;83 %PUT &amp;amp;=SQLOBS;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;SQLOBS=15&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Of course I could also do a select into variable, but just wanted get clarification or guidance on why sqlobs returns different results.&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 03 May 2019 19:35:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556081#M154858</guid>
      <dc:creator>jffeudo86</dc:creator>
      <dc:date>2019-05-03T19:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent results by SQLOBS depending on NOPRINT option in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556085#M154861</link>
      <description>&lt;P&gt;from the docs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="xis-term"&gt;SQLOBS&lt;/DIV&gt;
&lt;DIV class="xis-definition"&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;contains the number of rows that were processed by an SQL procedure statement. For example, the SQLOBS macro variable contains the number of rows that were formatted and displayed in SAS output by a SELECT statement or the number of rows that were deleted by a DELETE statement.&lt;/DIV&gt;
&lt;DIV class="xis-paraSimple"&gt;&lt;A id="p0kbvs4tep3uxyn1kh9q0l7420bh" target="_blank"&gt;&lt;/A&gt;When the NOPRINT option is specified, the value of the SQLOBS macro variable depends on whether an output table, single macro variable, macro variable list, or macro variable range is created:&lt;/DIV&gt;
&lt;DIV class="xis-listUnordered"&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class="xis-item"&gt;&lt;A id="n0f0ffx72cwjyon19wcrcgnd1a4w" target="_blank"&gt;&lt;/A&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;&lt;A id="n1ce9su8nkn2x4n1lcze3w9ygy4v" target="_blank"&gt;&lt;/A&gt;If no output table, macro variable list, or macro variable range is created, then SQLOBS contains the value 1.&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class="xis-item"&gt;&lt;A id="n0glwjkqc8br30n1rdorbcvk5p5q" target="_blank"&gt;&lt;/A&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;&lt;A id="p0t1mcds6zsochn1om9qiixjkhyx" target="_blank"&gt;&lt;/A&gt;If an output table is created, then SQLOBS contains the number of rows in the output table.&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class="xis-item"&gt;&lt;A id="p018mhmf9l5hb3n17wugpaw4vdo7" target="_blank"&gt;&lt;/A&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;&lt;A id="n1j6b59cd0u33bn15c7o1wz6kdws" target="_blank"&gt;&lt;/A&gt;If a single macro variable is created, then SQLOBS contains the value 1.&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class="xis-item"&gt;&lt;A id="n05loshhywssaen1snqck755nhnt" target="_blank"&gt;&lt;/A&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;&lt;A id="p0aupm27x0edbzn1ts6x9gpivr8r" target="_blank"&gt;&lt;/A&gt;If a macro variable list or macro variable range is created, then SQLOBS contains the number of rows that are processed to create the macro variable list or range.&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;/DIV&gt;
&lt;DIV class="xis-paraSimple"&gt;&lt;A id="p0a4hgb8f41aoln1jdigosro43wp" target="_blank"&gt;&lt;/A&gt;If an SQL view is created, then SQLOBS contains the value 0.&lt;/DIV&gt;
&lt;DIV class="xis-note"&gt;&lt;A id="p1s66n9iuh2tr0n1fkb1okfuguw0" target="_blank"&gt;&lt;/A&gt;&lt;SPAN class="xis-noteGenText"&gt;Note:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;The SQLOBS automatic macro variable is assigned a value after the SQL SELECT statement executes.&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 03 May 2019 19:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556085#M154861</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-05-03T19:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent results by SQLOBS depending on NOPRINT option in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556088#M154863</link>
      <description>That makes sense now. Thank you!</description>
      <pubDate>Fri, 03 May 2019 19:47:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556088#M154863</guid>
      <dc:creator>jffeudo86</dc:creator>
      <dc:date>2019-05-03T19:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent results by SQLOBS depending on NOPRINT option in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556089#M154864</link>
      <description>&lt;P&gt;It is just telling you what it did.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the NOPRINT option set it was smart enough to know it didn't need to keep running the select statement since it wasn't putting the result anywhere.&amp;nbsp; You can still use it to tell the difference between an empty query and one that returns at least on observation.&lt;/P&gt;
&lt;PRE&gt;255   proc sql noprint;
256   select name,sex from sashelp.class where sex='M';
257   %put &amp;amp;=sqlobs  ;
SQLOBS=1
258   select name,sex from sashelp.class where sex='XXX';
NOTE: No rows were selected.
259   %put &amp;amp;=sqlobs  ;
SQLOBS=0
&lt;/PRE&gt;
&lt;P&gt;You will see similar results with SELECT ... INTO giving a different count depending whether you use the SEPARATED BY clause or not.&lt;/P&gt;
&lt;PRE&gt;260   select name into :namelist from sashelp.class;
261   %put &amp;amp;=sqlobs &amp;amp;=namelist ;
SQLOBS=1 NAMELIST=Alfred
262   select name into :namelist separated by ' '
263     from sashelp.class where sex='F';
264   %put &amp;amp;=sqlobs &amp;amp;=namelist ;
SQLOBS=9 NAMELIST=Alice Barbara Carol Jane Janet Joyce Judy Louise Mary
265   quit;
&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 May 2019 19:47:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556089#M154864</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-03T19:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent results by SQLOBS depending on NOPRINT option in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556093#M154868</link>
      <description>So in the case where I need to know the count of the variables from a dataset,&lt;BR /&gt;1.) do a proc contents (as in my example), and&lt;BR /&gt;2.) do a select count(*) into &amp;lt;variable&amp;gt; from the output of proc contents, rather than use the sqlobs variable.</description>
      <pubDate>Fri, 03 May 2019 19:53:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556093#M154868</guid>
      <dc:creator>jffeudo86</dc:creator>
      <dc:date>2019-05-03T19:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent results by SQLOBS depending on NOPRINT option in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556095#M154870</link>
      <description>Pull that information from the sashelp.vtable information instead, it has the metadata for your SAS data sets, but not datasets that may reside on a server such as Oracle.</description>
      <pubDate>Fri, 03 May 2019 19:54:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556095#M154870</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-03T19:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent results by SQLOBS depending on NOPRINT option in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556108#M154873</link>
      <description>must I understand, that there must be an output (even print) for the sqlobs macro variable contains the value?</description>
      <pubDate>Fri, 03 May 2019 21:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556108#M154873</guid>
      <dc:creator>mansour_ib_sas</dc:creator>
      <dc:date>2019-05-03T21:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent results by SQLOBS depending on NOPRINT option in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556110#M154874</link>
      <description>Depends on what you call an 'output'. Macro variables creation will still work. I think the key is, what causes SAS to not read/process the whole data set, because in those cases it won't have the N available in SQLOBS. But SAS stores the metadata such as type/format/informat and count for every table and every column in every table in the dictionary tables.</description>
      <pubDate>Fri, 03 May 2019 21:45:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556110#M154874</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-03T21:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent results by SQLOBS depending on NOPRINT option in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556113#M154875</link>
      <description>&lt;P&gt;precisely, to have the N, you need a data output and print from what I just understood, is considered by sas as an output as well as a table creation.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 21:52:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556113#M154875</guid>
      <dc:creator>mansour_ib_sas</dc:creator>
      <dc:date>2019-05-03T21:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent results by SQLOBS depending on NOPRINT option in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556116#M154876</link>
      <description>To have the N in SQLOBS, yes it has to process the data. But that's really only useful as a step in your process to save you from having to separately calculate it. It's available in other places so you don't have to process the data just retrieve the count alone. It depends on what you're trying to do overall, but we don't know what that is at the moment.</description>
      <pubDate>Fri, 03 May 2019 22:01:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556116#M154876</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-03T22:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent results by SQLOBS depending on NOPRINT option in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556165#M154904</link>
      <description>&lt;P&gt;using the following code to replace.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL ;

create table _null_ as 

SELECT *
FROM CarVars;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 04 May 2019 11:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inconsistent-results-by-SQLOBS-depending-on-NOPRINT-option-in/m-p/556165#M154904</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-05-04T11:29:26Z</dc:date>
    </item>
  </channel>
</rss>

