<?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 resolved in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625684#M184443</link>
    <description>&lt;P&gt;Thanks for your reply! NOVINOSRIN also point this out. I think that is the problem.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Feb 2020 19:29:17 GMT</pubDate>
    <dc:creator>sasecn</dc:creator>
    <dc:date>2020-02-18T19:29:17Z</dc:date>
    <item>
      <title>Macro variable not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625663#M184426</link>
      <description>&lt;P&gt;I tried to used macro variables to create subsets from a large table. The example is to subset sashelp.cars into 3 tables by variable: Origin. The code was working in the past, at least worked in Nov. 2019. But now I got the error meassage:&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference C not resolved.&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:&lt;BR /&gt;&amp;amp;c&lt;BR /&gt;ERROR: The %TO value of the %DO I loop is invalid.&lt;BR /&gt;ERROR: The macro T will stop executing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think it is because macro variable C was not resolved, but i could be wrong. Any help would be great, thanks!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table test as
select distinct origin, count(distinct origin) into :origin1-, :c
from sashelp.cars
;
quit;

%macro t;
proc sql;
%do i=1 %to &amp;amp;c;
create table &amp;amp;&amp;amp;origin&amp;amp;i as
select origin
from sashelp.cars
where origin="&amp;amp;&amp;amp;origin&amp;amp;i";
%end;
quit;
%mend t;

%t&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Feb 2020 19:03:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625663#M184426</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2020-02-18T19:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625668#M184431</link>
      <description>&lt;P&gt;Post the log and error. Make sure to have set the macro debugging options before running the code and then post the log with that extra information, if you don't figure it out from there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint symbolgen;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/84484"&gt;@sasecn&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I tried to used macro variables to create subsets from a large table. The example is to subset sashelp.cars into 3 tables by variable: Origin. The code was working in the past, at least worked in Nov. 2019. But now I got the error meassage:&lt;/P&gt;
&lt;P&gt;WARNING: Apparent symbolic reference C not resolved.&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:&lt;BR /&gt;&amp;amp;c&lt;BR /&gt;ERROR: The %TO value of the %DO I loop is invalid.&lt;BR /&gt;ERROR: The macro T will stop executing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think it is because macro variable C was not resolved, but i could be wrong. Any help would be great, thanks!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table test as
select distinct origin, count(distinct origin) into :origin1-, :c
from sashelp.cars
;
quit;

%macro t;
proc sql;
%do i=1 %to &amp;amp;c;
create table &amp;amp;&amp;amp;origin&amp;amp;i as
select origin
from sashelp.cars
where origin="&amp;amp;&amp;amp;origin&amp;amp;i";
%end;
quit;
%mend t;

%t&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 19:07:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625668#M184431</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-02-18T19:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625672#M184435</link>
      <description>&lt;P&gt;P.S. i am using EG 7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;24 proc sql;&lt;BR /&gt;25 create table test as&lt;BR /&gt;26 select distinct origin, count(distinct origin) into :origin1-, :c&lt;BR /&gt;27 from sashelp.cars&lt;BR /&gt;28 ;&lt;BR /&gt;WARNING: INTO clause is ignored in the CREATE TABLE statement.&lt;BR /&gt;NOTE: The query requires remerging summary statistics back with the original data.&lt;BR /&gt;NOTE: Table WORK.TEST created, with 3 rows and 2 columns.&lt;/P&gt;&lt;P&gt;29 quit;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.05 seconds&lt;BR /&gt;cpu time 0.04 seconds&lt;/P&gt;&lt;P&gt;30&lt;BR /&gt;31 %macro t;&lt;BR /&gt;32 proc sql;&lt;BR /&gt;33 %do i=1 %to &amp;amp;c;&lt;BR /&gt;34 create table &amp;amp;&amp;amp;origin&amp;amp;i as&lt;BR /&gt;35 select origin&lt;BR /&gt;36 from sashelp.cars&lt;BR /&gt;37 where origin="&amp;amp;&amp;amp;origin&amp;amp;i";&lt;BR /&gt;38 %end;&lt;BR /&gt;39 quit;&lt;BR /&gt;40 %mend t;&lt;BR /&gt;41&lt;BR /&gt;42 %t&lt;BR /&gt;WARNING: Apparent symbolic reference C not resolved.&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:&lt;BR /&gt;&amp;amp;c&lt;BR /&gt;ERROR: The %TO value of the %DO I loop is invalid.&lt;BR /&gt;ERROR: The macro T will stop executing.&lt;BR /&gt;43&lt;BR /&gt;2 The SAS System 13:43 Tuesday, February 18, 2020&lt;/P&gt;&lt;P&gt;44 GOPTIONS NOACCESSIBLE;&lt;BR /&gt;45 %LET _CLIENTTASKLABEL=;&lt;BR /&gt;46 %LET _CLIENTPROCESSFLOWNAME=;&lt;BR /&gt;47 %LET _CLIENTPROJECTPATH=;&lt;BR /&gt;48 %LET _CLIENTPROJECTNAME=;&lt;BR /&gt;49 %LET _SASPROGRAMFILE=;&lt;BR /&gt;50&lt;BR /&gt;51 ;*';*";*/;quit;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;51 ! run;&lt;BR /&gt;52 ODS _ALL_ CLOSE;&lt;BR /&gt;53&lt;BR /&gt;54&lt;BR /&gt;55 QUIT; RUN;&lt;BR /&gt;56&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 19:08:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625672#M184435</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2020-02-18T19:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625677#M184439</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/84484"&gt;@sasecn&lt;/a&gt;&amp;nbsp; You can't CREATE TABLE when using INTO clause&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try the corrected below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sql;
select distinct origin, count(distinct origin) into :origin1-,  :c
from sashelp.cars
;
quit;

%put &amp;amp;=c;

%macro t;
proc sql;
%do i=1 %to &amp;amp;c;
create table &amp;amp;&amp;amp;origin&amp;amp;i as
select origin
from sashelp.cars
where origin="&amp;amp;&amp;amp;origin&amp;amp;i";
%end;
quit;
%mend t;

%t&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Feb 2020 19:21:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625677#M184439</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-02-18T19:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625681#M184440</link>
      <description>&lt;P&gt;Thanks, i don't know that i cannot create table when using into.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 19:26:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625681#M184440</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2020-02-18T19:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625682#M184441</link>
      <description>&lt;P&gt;Well, the issue pretty much jumps out:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;24 proc sql;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;25 create table test as&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;26 select distinct origin, count(distinct origin) into&amp;nbsp;&lt;/SPAN&gt;&lt;IMG class="emoticon emoticon-smileysurprised" src="https://communities.sas.com/i/smilies/16x16_smiley-surprised.png" border="0" alt="Smiley Surprised" title="Smiley Surprised" /&gt;&lt;SPAN&gt;rigin1-, :c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;27 from sashelp.cars&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;28 ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;WARNING: INTO clause is ignored in the CREATE TABLE statement.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;SPAN&gt;NOTE: The query requires remerging summary statistics back with the original data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NOTE: Table WORK.TEST created, with 3 rows and 2 columns.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Why are you creating a table if you only need macro variables? Try removing the CREATE TABLE portion and see what happens.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/84484"&gt;@sasecn&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;P.S. i am using EG 7&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;24 proc sql;&lt;BR /&gt;25 create table test as&lt;BR /&gt;26 select distinct origin, count(distinct origin) into :origin1-, :c&lt;BR /&gt;27 from sashelp.cars&lt;BR /&gt;28 ;&lt;BR /&gt;WARNING: INTO clause is ignored in the CREATE TABLE statement.&lt;BR /&gt;NOTE: The query requires remerging summary statistics back with the original data.&lt;BR /&gt;NOTE: Table WORK.TEST created, with 3 rows and 2 columns.&lt;/P&gt;
&lt;P&gt;29 quit;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.05 seconds&lt;BR /&gt;cpu time 0.04 seconds&lt;/P&gt;
&lt;P&gt;30&lt;BR /&gt;31 %macro t;&lt;BR /&gt;32 proc sql;&lt;BR /&gt;33 %do i=1 %to &amp;amp;c;&lt;BR /&gt;34 create table &amp;amp;&amp;amp;origin&amp;amp;i as&lt;BR /&gt;35 select origin&lt;BR /&gt;36 from sashelp.cars&lt;BR /&gt;37 where origin="&amp;amp;&amp;amp;origin&amp;amp;i";&lt;BR /&gt;38 %end;&lt;BR /&gt;39 quit;&lt;BR /&gt;40 %mend t;&lt;BR /&gt;41&lt;BR /&gt;42 %t&lt;BR /&gt;WARNING: Apparent symbolic reference C not resolved.&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:&lt;BR /&gt;&amp;amp;c&lt;BR /&gt;ERROR: The %TO value of the %DO I loop is invalid.&lt;BR /&gt;ERROR: The macro T will stop executing.&lt;BR /&gt;43&lt;BR /&gt;2 The SAS System 13:43 Tuesday, February 18, 2020&lt;/P&gt;
&lt;P&gt;44 GOPTIONS NOACCESSIBLE;&lt;BR /&gt;45 %LET _CLIENTTASKLABEL=;&lt;BR /&gt;46 %LET _CLIENTPROCESSFLOWNAME=;&lt;BR /&gt;47 %LET _CLIENTPROJECTPATH=;&lt;BR /&gt;48 %LET _CLIENTPROJECTNAME=;&lt;BR /&gt;49 %LET _SASPROGRAMFILE=;&lt;BR /&gt;50&lt;BR /&gt;51 ;*';*";*/;quit;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;51 ! run;&lt;BR /&gt;52 ODS _ALL_ CLOSE;&lt;BR /&gt;53&lt;BR /&gt;54&lt;BR /&gt;55 QUIT; RUN;&lt;BR /&gt;56&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Tue, 18 Feb 2020 19:26:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625682#M184441</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-02-18T19:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625684#M184443</link>
      <description>&lt;P&gt;Thanks for your reply! NOVINOSRIN also point this out. I think that is the problem.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 19:29:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625684#M184443</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2020-02-18T19:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625687#M184445</link>
      <description>The log tells you this is the problem.</description>
      <pubDate>Tue, 18 Feb 2020 19:33:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625687#M184445</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-02-18T19:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625691#M184448</link>
      <description>&lt;P&gt;Remove the CREATE TABLE part.&amp;nbsp; Add the NOPRINT option to avoid cluttering your output with the list of values. No need to count, SAS will count for you into the SQLOBS macro variable.&amp;nbsp; You can save the value into another macro variable if you want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select distinct origin into :origin1-
from sashelp.cars
;
%let c=&amp;amp;sqlobs;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Feb 2020 19:45:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625691#M184448</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-18T19:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625846#M184523</link>
      <description>&lt;P&gt;Thanks, good to know!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 14:28:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-not-resolved/m-p/625846#M184523</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2020-02-19T14:28:53Z</dc:date>
    </item>
  </channel>
</rss>

