<?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: macro variable not resolving in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/macro-variable-not-resolving/m-p/229397#M16699</link>
    <description>&lt;P&gt;For efficiency purposes, this sort of problem is usually handled a little differently. &amp;nbsp;Notice that your original code executes CALL SYMPUT for each observation in the data set. &amp;nbsp;It that's a million times, you might be slowing the program down. &amp;nbsp;An alternative:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;call symputx("no_of_obs", _nobs_);&lt;/P&gt;
&lt;P&gt;stop;&lt;/P&gt;
&lt;P&gt;set a nobs=_nobs_;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that switching to CALL SYMPUTX will remove from your log the message about numeric to character conversion, and will remove leading blanks from the value of &amp;amp;NO_OF_OBS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
    <pubDate>Sat, 10 Oct 2015 00:57:56 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2015-10-10T00:57:56Z</dc:date>
    <item>
      <title>macro variable not resolving</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/macro-variable-not-resolving/m-p/229349#M16695</link>
      <description>&lt;P&gt;please help,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have one dataset "&lt;STRONG&gt;A&lt;/STRONG&gt;" which has one variable "&lt;STRONG&gt;test&lt;/STRONG&gt;" which came out with &lt;STRONG&gt;zero observation&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i wants to mention it in auto email from SAS to team that "&lt;U&gt;we have &lt;STRONG&gt;&amp;amp;no_of_obs&lt;/STRONG&gt; observation for test&lt;/U&gt;" but problem is my below macro variable,&lt;STRONG&gt;no_of_obs,&lt;/STRONG&gt; is resolving to &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&amp;amp;no_of_obs &lt;/STRONG&gt;&lt;FONT color="#000000"&gt;only since i have zero observation, &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;is there any work around to resolve it to zero (0)?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data _null_;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;set a;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;call symput("&lt;STRONG&gt;no_of_obs&lt;/STRONG&gt;",_n_);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2015 19:18:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/macro-variable-not-resolving/m-p/229349#M16695</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2015-10-09T19:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable not resolving</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/macro-variable-not-resolving/m-p/229353#M16696</link>
      <description>&lt;P&gt;Change the order of the statements. &amp;nbsp;SAS stops the data step as soon as it reads past the end of the input stream. So the CALL SYMPUT() never runs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  call symputX("no_of_obs",_n_-1);
  set a;
run;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Oct 2015 19:40:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/macro-variable-not-resolving/m-p/229353#M16696</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-10-09T19:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable not resolving</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/macro-variable-not-resolving/m-p/229358#M16697</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let no_of_obs=0;
data _null_;
set a;
call symput("no_of_obs",_n_);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Oct 2015 19:44:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/macro-variable-not-resolving/m-p/229358#M16697</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-10-09T19:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable not resolving</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/macro-variable-not-resolving/m-p/229382#M16698</link>
      <description>&lt;P&gt;Thanks Tom, it worked fine,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;@ Miller - in my case, its not a case where i will always get 0 obs, could be possible obs&amp;gt;0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2015 22:19:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/macro-variable-not-resolving/m-p/229382#M16698</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2015-10-09T22:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable not resolving</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/macro-variable-not-resolving/m-p/229397#M16699</link>
      <description>&lt;P&gt;For efficiency purposes, this sort of problem is usually handled a little differently. &amp;nbsp;Notice that your original code executes CALL SYMPUT for each observation in the data set. &amp;nbsp;It that's a million times, you might be slowing the program down. &amp;nbsp;An alternative:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;call symputx("no_of_obs", _nobs_);&lt;/P&gt;
&lt;P&gt;stop;&lt;/P&gt;
&lt;P&gt;set a nobs=_nobs_;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that switching to CALL SYMPUTX will remove from your log the message about numeric to character conversion, and will remove leading blanks from the value of &amp;amp;NO_OF_OBS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Oct 2015 00:57:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/macro-variable-not-resolving/m-p/229397#M16699</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-10-10T00:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable not resolving</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/macro-variable-not-resolving/m-p/229684#M16711</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/26689"&gt;@woo&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;@ Miller - in my case, its not a case where i will always get 0 obs, could be possible obs&amp;gt;0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, the code as I wrote it will produce a result of 0 if there is no data, and a positive number equal to the number of observations when there is a positive number of data points.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2015 12:30:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/macro-variable-not-resolving/m-p/229684#M16711</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-10-13T12:30:16Z</dc:date>
    </item>
  </channel>
</rss>

