<?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 Query -- Test for No Observations and Output Message in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34475#M8423</link>
    <description>Yes, I need it in pdf for distribution.&lt;BR /&gt;
&lt;BR /&gt;
I get the same warning "Into clause specifies fewer host variables .....</description>
    <pubDate>Tue, 22 Mar 2011 14:16:49 GMT</pubDate>
    <dc:creator>MikeCa</dc:creator>
    <dc:date>2011-03-22T14:16:49Z</dc:date>
    <item>
      <title>Proc SQL Query -- Test for No Observations and Output Message</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34470#M8418</link>
      <description>I'm using the following SQL procedure to query any variances that exist.  When no variances exist I would like to print out the message "No Variances were Found!"  How do I test for that in the SQL procedure?  Thanks&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
 options nonumber nodate;&lt;BR /&gt;
 ods escapechar = "^";&lt;BR /&gt;
 ods pdf file = "U:\Reconcilement_COAD_TH_Files.pdf";&lt;BR /&gt;
&lt;BR /&gt;
Title1 "^S={just=C color=blue}Reconcile COAD File to TH File -- Below are the Variances";&lt;BR /&gt;
 proc sql;&lt;BR /&gt;
	select COADAcct, THAmt, COADAmt, Variance&lt;BR /&gt;
	from Combined c&lt;BR /&gt;
	where c.Variance ^=0;&lt;BR /&gt;
quit;&lt;BR /&gt;
ods pdf close;&lt;BR /&gt;
ods listing;</description>
      <pubDate>Mon, 21 Mar 2011 16:27:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34470#M8418</guid>
      <dc:creator>MikeCa</dc:creator>
      <dc:date>2011-03-21T16:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Query -- Test for No Observations and Output Message</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34471#M8419</link>
      <description>Hello MikeCa,&lt;BR /&gt;
&lt;BR /&gt;
This is possible solution:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%macro a;&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
options nonumber nodate;&lt;BR /&gt;
ods escapechar = "^";&lt;BR /&gt;
/*ods pdf file = "U:\Reconcilement_COAD_TH_Files.pdf";*/&lt;BR /&gt;
&lt;BR /&gt;
Title1 "^S={just=C color=blue}Reconcile COAD File to TH File -- Below are the Variances";&lt;BR /&gt;
proc sql;&lt;BR /&gt;
select Count(*) as N, COADAcct, THAmt, COADAmt, Variance into :n &lt;BR /&gt;
/*from Combined c*/&lt;BR /&gt;
from c&lt;BR /&gt;
where c.Variance ^=0;&lt;BR /&gt;
quit;&lt;BR /&gt;
%if &amp;amp;n=0 %then %put No Variances were Found!;&lt;BR /&gt;
ods pdf close;&lt;BR /&gt;
ods listing; &lt;BR /&gt;
%mend a;&lt;BR /&gt;
%a&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Mon, 21 Mar 2011 17:41:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34471#M8419</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-03-21T17:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Query -- Test for No Observations and Output Message</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34472#M8420</link>
      <description>Thanks, I've run it and understand it somewhat.  The piece I don't get is that it is printing a null record in the pdf output instead of the Phrase "No Variances were Found!?  Any Hints?</description>
      <pubDate>Tue, 22 Mar 2011 13:43:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34472#M8420</guid>
      <dc:creator>MikeCa</dc:creator>
      <dc:date>2011-03-22T13:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Query -- Test for No Observations and Output Message</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34473#M8421</link>
      <description>Don't you want...&lt;BR /&gt;
select Count(*) into :n, COADAcct, THAmt, COADAmt, Variance&lt;BR /&gt;
&lt;BR /&gt;
and then test for &amp;amp;n.?</description>
      <pubDate>Tue, 22 Mar 2011 13:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34473#M8421</guid>
      <dc:creator>DavidJ</dc:creator>
      <dc:date>2011-03-22T13:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Query -- Test for No Observations and Output Message</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34474#M8422</link>
      <description>It outputs warning into the LOG. Is it critical to have it in PDF?&lt;BR /&gt;
&lt;BR /&gt;
SPR</description>
      <pubDate>Tue, 22 Mar 2011 14:10:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34474#M8422</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-03-22T14:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Query -- Test for No Observations and Output Message</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34475#M8423</link>
      <description>Yes, I need it in pdf for distribution.&lt;BR /&gt;
&lt;BR /&gt;
I get the same warning "Into clause specifies fewer host variables .....</description>
      <pubDate>Tue, 22 Mar 2011 14:16:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34475#M8423</guid>
      <dc:creator>MikeCa</dc:creator>
      <dc:date>2011-03-22T14:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Query -- Test for No Observations and Output Message</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34476#M8424</link>
      <description>How about this variant:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data c;&lt;BR /&gt;
  COADAcct=1; THAmt=1; COADAmt=3; Variance=0; output;&lt;BR /&gt;
  COADAcct=2; THAmt=10; COADAmt=8; Variance=0; output;&lt;BR /&gt;
run; &lt;BR /&gt;
%macro a;&lt;BR /&gt;
  ods listing close;&lt;BR /&gt;
  options nonumber nodate;&lt;BR /&gt;
  ods escapechar = "^";&lt;BR /&gt;
  /*ods pdf file = "U:\Reconcilement_COAD_TH_Files.pdf";*/&lt;BR /&gt;
  proc SQL noprint;&lt;BR /&gt;
    select Count(*) as N into :n &lt;BR /&gt;
    from c&lt;BR /&gt;
     where c.Variance ^=0;&lt;BR /&gt;
  quit;&lt;BR /&gt;
  %if &amp;amp;n=0 %then %do;&lt;BR /&gt;
    Title1 "^S={just=C color=blue}No Variances were Found!";&lt;BR /&gt;
    proc SQL;&lt;BR /&gt;
      select Variance &lt;BR /&gt;
      from c&lt;BR /&gt;
      where Variance ^=0;&lt;BR /&gt;
    quit;&lt;BR /&gt;
  %end;&lt;BR /&gt;
  %else %do;&lt;BR /&gt;
    Title1 "^S={just=C color=blue}Reconcile COAD File to TH File -- Below are the Variances";&lt;BR /&gt;
    proc sql;&lt;BR /&gt;
      select COADAcct, THAmt, COADAmt, Variance &lt;BR /&gt;
      /*from Combined c*/&lt;BR /&gt;
      from c&lt;BR /&gt;
      where c.Variance ^=0;&lt;BR /&gt;
    quit;&lt;BR /&gt;
  %end;&lt;BR /&gt;
  ods pdf close;&lt;BR /&gt;
  ods listing;&lt;BR /&gt;
%mend a;&lt;BR /&gt;
&lt;BR /&gt;
%a&lt;BR /&gt;
[/pre]&lt;BR /&gt;
SPR</description>
      <pubDate>Tue, 22 Mar 2011 14:44:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34476#M8424</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-03-22T14:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Query -- Test for No Observations and Output Message</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34477#M8425</link>
      <description>Perfect!  Thanks for another Lesson!</description>
      <pubDate>Tue, 22 Mar 2011 15:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34477#M8425</guid>
      <dc:creator>MikeCa</dc:creator>
      <dc:date>2011-03-22T15:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Query -- Test for No Observations and Output Message</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34478#M8426</link>
      <description>SPR is wrong. Title statement is global statement ,You can not use it conditionally.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;DIV class="Section1"&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;B&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: navy; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;%macro&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt; &lt;B&gt;&lt;I&gt;title&lt;/I&gt;&lt;/B&gt;;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN class="GramE"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;data&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt; temp;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;&lt;SPAN style=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="GramE"&gt;title&lt;/SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: purple; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;'No Variances were Found!'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN class="GramE"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;run&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN class="SpellE"&gt;&lt;SPAN class="GramE"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;ods&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt; listing close;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN class="GramE"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;options&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt; &lt;SPAN class="SpellE"&gt;nonumber&lt;/SPAN&gt; &lt;SPAN class="SpellE"&gt;nodate&lt;/SPAN&gt;;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN class="SpellE"&gt;&lt;SPAN class="GramE"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;ods&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt; &lt;SPAN class="SpellE"&gt;escapechar&lt;/SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: purple; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;"^"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN class="SpellE"&gt;&lt;SPAN class="GramE"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;ods&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt; &lt;SPAN class="SpellE"&gt;pdf&lt;/SPAN&gt; file = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: purple; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;"c:\x.pdf"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;Title1 &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: purple; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;"^S&lt;SPAN class="GramE"&gt;={&lt;/SPAN&gt;just=C&lt;BR /&gt;
color=blue}Reconcile COAD File to TH File -- Below are the Variances"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN class="GramE"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;proc&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt; &lt;SPAN class="SpellE"&gt;sql&lt;/SPAN&gt;;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN class="GramE"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;select&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt; &lt;SPAN class="SpellE"&gt;region,product&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;&lt;SPAN style=""&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="GramE"&gt;from&lt;/SPAN&gt; &lt;SPAN class="SpellE"&gt;sashelp.shoes&lt;/SPAN&gt; c&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;&lt;SPAN style=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="GramE"&gt;where&lt;/SPAN&gt;&lt;BR /&gt;
&lt;SPAN class="SpellE"&gt;c.region&lt;/SPAN&gt; &lt;SPAN class="SpellE"&gt;eq&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: purple; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;'&lt;COUNTRY-REGION st="on"&gt;&lt;PLACE st="on"&gt;China&lt;/PLACE&gt;&lt;/COUNTRY-REGION&gt;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;%if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt; &amp;amp;&lt;/SPAN&gt;&lt;SPAN class="SpellE"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;sqlobs&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt; &lt;SPAN class="SpellE"&gt;&lt;SPAN class="GramE"&gt;eq&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;0&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;%then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;&lt;SPAN style=""&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="GramE"&gt;select&lt;/SPAN&gt; title&lt;BR /&gt;
label=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: purple; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;'#'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;&lt;SPAN style=""&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="GramE"&gt;from&lt;/SPAN&gt;&lt;BR /&gt;
temp;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;; &lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN class="GramE"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;quit&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN class="SpellE"&gt;&lt;SPAN class="GramE"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;ods&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt; &lt;SPAN class="SpellE"&gt;pdf&lt;/SPAN&gt; close;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN class="SpellE"&gt;&lt;SPAN class="GramE"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;ods&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt; listing;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;B&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: navy; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;%mend&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal" style="text-align: left;" align="left"&gt;&lt;SPAN style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: black; background: none repeat scroll 0% 0% white;" lang="EN-US"&gt;%&lt;B&gt;&lt;I&gt;title&lt;/I&gt;&lt;/B&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal"&gt;&lt;SPAN lang="EN-US"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal"&gt;&lt;SPAN lang="EN-US"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal"&gt;&lt;SPAN lang="EN-US"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal"&gt;&lt;SPAN lang="EN-US"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="MsoNormal"&gt;&lt;SPAN class="SpellE"&gt;&lt;SPAN style="color: rgb(0, 51, 102);" lang="EN-US"&gt;Ksharp&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: rgb(0, 51, 102);" lang="EN-US"&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 23 Mar 2011 02:17:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34478#M8426</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-03-23T02:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Query -- Test for No Observations and Output Message</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34479#M8427</link>
      <description>Actually SPR’s program works fine.  While a title statement is a global statement, the statement is never passed to the input stack to be executed unless the %if statement is true.  You can’t conditionally execute global statements in a data step but you can conditionally execute them in a macro.</description>
      <pubDate>Wed, 23 Mar 2011 10:02:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34479#M8427</guid>
      <dc:creator>polingjw</dc:creator>
      <dc:date>2011-03-23T10:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Query -- Test for No Observations and Output Message</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34480#M8428</link>
      <description>Honestly, Ksharp you need to sharpen your mouse-cursor, given recent inaccurate post-replies on the forums here. &lt;BR /&gt;
&lt;BR /&gt;
As mentioned by polingjw, a TITLE statement can be conditionally executed in various ways, one showed was with a MACRO invocation, using PROC SQL to detect a condition, setting a macro variable indicator, and testing that indicator to determine code-path.&lt;BR /&gt;
&lt;BR /&gt;
Also, consider the TOP "clause" equivalent, your SAS code post-reply provided no "group-level" TOP(nn) equivalent, only where your code generates observations that have the MAX(SALES) value, instead.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.

Message was edited by: sbb</description>
      <pubDate>Wed, 23 Mar 2011 12:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Query-Test-for-No-Observations-and-Output-Message/m-p/34480#M8428</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-03-23T12:38:37Z</dc:date>
    </item>
  </channel>
</rss>

