<?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: URGENT ! numeric value of a global macro as an input to a macro? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/URGENT-numeric-value-of-a-global-macro-as-an-input-to-a-macro/m-p/50055#M10438</link>
    <description>Dear SPR!&lt;BR /&gt;
&lt;BR /&gt;
Thank you so much, it worked!</description>
    <pubDate>Wed, 13 Apr 2011 21:14:32 GMT</pubDate>
    <dc:creator>sasuser1000</dc:creator>
    <dc:date>2011-04-13T21:14:32Z</dc:date>
    <item>
      <title>URGENT ! numeric value of a global macro as an input to a macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/URGENT-numeric-value-of-a-global-macro-as-an-input-to-a-macro/m-p/50053#M10436</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
i cant make this work and it's very urgent, please help!&lt;BR /&gt;
&lt;BR /&gt;
this is the log :&lt;BR /&gt;
&lt;BR /&gt;
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric&lt;BR /&gt;
       operand is required. The condition was: &amp;amp;NOBSI&lt;BR /&gt;
ERROR: The %TO value of the %DO I loop is invalid.&lt;BR /&gt;
ERROR: The macro ADJUST will stop executing.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
This is the code:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data _null_; &lt;BR /&gt;
set list1 nobs=nobs; &lt;BR /&gt;
call symputn ('NOBSI',nobs); &lt;BR /&gt;
stop; &lt;BR /&gt;
run; &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%macro ADJUST(NOBSI); &lt;BR /&gt;
&lt;BR /&gt;
%do I=1 %TO &amp;amp;NOBSI; &lt;BR /&gt;
.etc&lt;BR /&gt;
.etc&lt;BR /&gt;
.etc&lt;BR /&gt;
.&lt;BR /&gt;
%end; &lt;BR /&gt;
&lt;BR /&gt;
%mend; /*end of macro*/&lt;BR /&gt;
&lt;BR /&gt;
/* here I create a datastep in order to be able to use symget&lt;BR /&gt;
 &lt;BR /&gt;
data A; &lt;BR /&gt;
NOBSI=SYMGETn ('NOBSI'); &lt;BR /&gt;
&lt;BR /&gt;
%ADJUST(NOBS) ; &lt;BR /&gt;
&lt;BR /&gt;
RUN;</description>
      <pubDate>Wed, 13 Apr 2011 20:26:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/URGENT-numeric-value-of-a-global-macro-as-an-input-to-a-macro/m-p/50053#M10436</guid>
      <dc:creator>sasuser1000</dc:creator>
      <dc:date>2011-04-13T20:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT ! numeric value of a global macro as an input to a macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/URGENT-numeric-value-of-a-global-macro-as-an-input-to-a-macro/m-p/50054#M10437</link>
      <description>Hello SASUser1000,&lt;BR /&gt;
&lt;BR /&gt;
I found 2 problems with your code:&lt;BR /&gt;
&lt;BR /&gt;
1. In data _null_; it should be call symputx ('NOBSI',nobs);&lt;BR /&gt;
2. In data A it is impossible to create macro variable and use it in the same datastep.  &lt;BR /&gt;
&lt;BR /&gt;
This is a correct veriosn of your program:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data list1;&lt;BR /&gt;
  do i=1 to 10;&lt;BR /&gt;
    output;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
data _null_; &lt;BR /&gt;
set list1 nobs=nobs; &lt;BR /&gt;
call symputx ('NOBSI',nobs); &lt;BR /&gt;
stop; &lt;BR /&gt;
run; &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%macro ADJUST(NOBSI); &lt;BR /&gt;
%local i;&lt;BR /&gt;
%do I=1 %TO &amp;amp;NOBSI; &lt;BR /&gt;
 %put i=&amp;amp;i;&lt;BR /&gt;
%end;&lt;BR /&gt;
%mend; /*end of macro*/&lt;BR /&gt;
&lt;BR /&gt;
%adjust(&amp;amp;nobsi)&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Wed, 13 Apr 2011 20:48:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/URGENT-numeric-value-of-a-global-macro-as-an-input-to-a-macro/m-p/50054#M10437</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-04-13T20:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT ! numeric value of a global macro as an input to a macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/URGENT-numeric-value-of-a-global-macro-as-an-input-to-a-macro/m-p/50055#M10438</link>
      <description>Dear SPR!&lt;BR /&gt;
&lt;BR /&gt;
Thank you so much, it worked!</description>
      <pubDate>Wed, 13 Apr 2011 21:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/URGENT-numeric-value-of-a-global-macro-as-an-input-to-a-macro/m-p/50055#M10438</guid>
      <dc:creator>sasuser1000</dc:creator>
      <dc:date>2011-04-13T21:14:32Z</dc:date>
    </item>
  </channel>
</rss>

