<?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 A question in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/A-question/m-p/13476#M1988</link>
    <description>Hi, I am trying to find out why the data work.test2 has no observations, but both test3 and tes4 have c=1. Compared to test3, test2 misses one OUTPUT statement in the IF. Is this a problem? Clearly, the ELSE statement won't execute.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
DATA work.test;&lt;BR /&gt;
  a=1;&lt;BR /&gt;
  b=2;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
DATA work.test2;&lt;BR /&gt;
	SET work.test;&lt;BR /&gt;
	IF a&amp;gt;0 THEN c=1;&lt;BR /&gt;
	ELSE &lt;BR /&gt;
		DO;&lt;BR /&gt;
			C=2;&lt;BR /&gt;
			OUTPUT;&lt;BR /&gt;
		END;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
DATA work.test3;&lt;BR /&gt;
	SET work.test;&lt;BR /&gt;
	IF a&amp;gt;0 THEN&lt;BR /&gt;
		DO;&lt;BR /&gt;
			c=1;&lt;BR /&gt;
			OUTPUT;&lt;BR /&gt;
		END;&lt;BR /&gt;
	ELSE &lt;BR /&gt;
		DO;&lt;BR /&gt;
			C=2;&lt;BR /&gt;
			OUTPUT;&lt;BR /&gt;
		END;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
DATA work.test4;&lt;BR /&gt;
	SET work.test;&lt;BR /&gt;
	IF a&amp;gt;0 THEN c=1;&lt;BR /&gt;
	ELSE &lt;BR /&gt;
		DO;&lt;BR /&gt;
			C=2;&lt;BR /&gt;
		END;&lt;BR /&gt;
RUN;</description>
    <pubDate>Tue, 14 Jun 2011 18:00:08 GMT</pubDate>
    <dc:creator>Kevin_Graduate</dc:creator>
    <dc:date>2011-06-14T18:00:08Z</dc:date>
    <item>
      <title>A question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-question/m-p/13476#M1988</link>
      <description>Hi, I am trying to find out why the data work.test2 has no observations, but both test3 and tes4 have c=1. Compared to test3, test2 misses one OUTPUT statement in the IF. Is this a problem? Clearly, the ELSE statement won't execute.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
DATA work.test;&lt;BR /&gt;
  a=1;&lt;BR /&gt;
  b=2;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
DATA work.test2;&lt;BR /&gt;
	SET work.test;&lt;BR /&gt;
	IF a&amp;gt;0 THEN c=1;&lt;BR /&gt;
	ELSE &lt;BR /&gt;
		DO;&lt;BR /&gt;
			C=2;&lt;BR /&gt;
			OUTPUT;&lt;BR /&gt;
		END;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
DATA work.test3;&lt;BR /&gt;
	SET work.test;&lt;BR /&gt;
	IF a&amp;gt;0 THEN&lt;BR /&gt;
		DO;&lt;BR /&gt;
			c=1;&lt;BR /&gt;
			OUTPUT;&lt;BR /&gt;
		END;&lt;BR /&gt;
	ELSE &lt;BR /&gt;
		DO;&lt;BR /&gt;
			C=2;&lt;BR /&gt;
			OUTPUT;&lt;BR /&gt;
		END;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
DATA work.test4;&lt;BR /&gt;
	SET work.test;&lt;BR /&gt;
	IF a&amp;gt;0 THEN c=1;&lt;BR /&gt;
	ELSE &lt;BR /&gt;
		DO;&lt;BR /&gt;
			C=2;&lt;BR /&gt;
		END;&lt;BR /&gt;
RUN;</description>
      <pubDate>Tue, 14 Jun 2011 18:00:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-question/m-p/13476#M1988</guid>
      <dc:creator>Kevin_Graduate</dc:creator>
      <dc:date>2011-06-14T18:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: A question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-question/m-p/13477#M1989</link>
      <description>You only have one explicit OUTPUT statement coded inside a DO/END.&lt;BR /&gt;
&lt;BR /&gt;
Add this SAS statement at various points in your DATA step to analyze the processing by dumping all SAS variables to your SASLOG (change/identify each unique PUTLOG with the "nn" literal-constant):&lt;BR /&gt;
&lt;BR /&gt;
PUTLOG '&amp;gt;DIAG-nn&amp;gt;' / _ALL_;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 14 Jun 2011 18:08:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-question/m-p/13477#M1989</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-06-14T18:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: A question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-question/m-p/13478#M1990</link>
      <description>Yes this is a problem, output statements are defined at compile time I believe, not execution.&lt;BR /&gt;
&lt;BR /&gt;
Once you have an explicit output statement there is no more implicit output and you need to have an output statement where you want an output. &lt;BR /&gt;
&lt;BR /&gt;
As you noted the else statement won't execute so there won't be any output!.</description>
      <pubDate>Tue, 14 Jun 2011 20:26:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-question/m-p/13478#M1990</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2011-06-14T20:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: A question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-question/m-p/13479#M1991</link>
      <description>It is very helpful to use the PUTLOG _ALL_ indeed. I tried.</description>
      <pubDate>Wed, 15 Jun 2011 09:29:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-question/m-p/13479#M1991</guid>
      <dc:creator>Kevin_Graduate</dc:creator>
      <dc:date>2011-06-15T09:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: A question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-question/m-p/13480#M1992</link>
      <description>Thanks for advice, Reeza.</description>
      <pubDate>Wed, 15 Jun 2011 09:30:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-question/m-p/13480#M1992</guid>
      <dc:creator>Kevin_Graduate</dc:creator>
      <dc:date>2011-06-15T09:30:08Z</dc:date>
    </item>
  </channel>
</rss>

