<?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 Using CALL SYMPUT with a macro name that contains a variable in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Using-CALL-SYMPUT-with-a-macro-name-that-contains-a-variable/m-p/1875#M111</link>
    <description>Towards the top of my program, I have:&lt;BR /&gt;
&lt;BR /&gt;
%LOCAL ix;&lt;BR /&gt;
%LET ix = 1;&lt;BR /&gt;
%DO ix = 1 %to 4;&lt;BR /&gt;
    %LOCAL corra_&amp;amp;ix;&lt;BR /&gt;
    %LET corra_&amp;amp;ix = 9999;&lt;BR /&gt;
    ...&lt;BR /&gt;
%END;&lt;BR /&gt;
&lt;BR /&gt;
This compiles and runs without problems. I call %PUT _USER_ and I see all my variables defined among the others I have. (I've initialised them to 9999 because I can see later if any operations have been carried out later)&lt;BR /&gt;
&lt;BR /&gt;
My problem is coming later on:&lt;BR /&gt;
&lt;BR /&gt;
%do i = 1 %to 4;&lt;BR /&gt;
...&lt;BR /&gt;
            CALL SYMPUT(&lt;B&gt;%quote('CORRA_&amp;amp;i')&lt;/B&gt;, trim(left(put(DEPEN&amp;amp;i,5.3))));&lt;BR /&gt;
...&lt;BR /&gt;
%end;&lt;BR /&gt;
&lt;BR /&gt;
When the program runs, I want the result to be&lt;BR /&gt;
CALL SYMPUT('CORRA_1', trim(left(...)));&lt;BR /&gt;
CALL SYMPUT('CORRA_2', trim(left(...)));&lt;BR /&gt;
CALL SYMPUT('CORRA_3', trim(left(...)));&lt;BR /&gt;
CALL SYMPUT('CORRA_4', trim(left(...)));&lt;BR /&gt;
&lt;BR /&gt;
But I cannot for the life of me work out how to correctly resolve this. I'm either receiving notes in my log that my variable is uninitialised, or that the 'Apparent Symbolic Reference is not resolved'. In any case, when I use %PUT _USER_; later on, the variables are still equal to 9999.&lt;BR /&gt;
&lt;BR /&gt;
What should I put in place of the bold text to make this work?&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.</description>
    <pubDate>Fri, 01 Dec 2006 13:58:45 GMT</pubDate>
    <dc:creator>Colxfile</dc:creator>
    <dc:date>2006-12-01T13:58:45Z</dc:date>
    <item>
      <title>Using CALL SYMPUT with a macro name that contains a variable</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Using-CALL-SYMPUT-with-a-macro-name-that-contains-a-variable/m-p/1875#M111</link>
      <description>Towards the top of my program, I have:&lt;BR /&gt;
&lt;BR /&gt;
%LOCAL ix;&lt;BR /&gt;
%LET ix = 1;&lt;BR /&gt;
%DO ix = 1 %to 4;&lt;BR /&gt;
    %LOCAL corra_&amp;amp;ix;&lt;BR /&gt;
    %LET corra_&amp;amp;ix = 9999;&lt;BR /&gt;
    ...&lt;BR /&gt;
%END;&lt;BR /&gt;
&lt;BR /&gt;
This compiles and runs without problems. I call %PUT _USER_ and I see all my variables defined among the others I have. (I've initialised them to 9999 because I can see later if any operations have been carried out later)&lt;BR /&gt;
&lt;BR /&gt;
My problem is coming later on:&lt;BR /&gt;
&lt;BR /&gt;
%do i = 1 %to 4;&lt;BR /&gt;
...&lt;BR /&gt;
            CALL SYMPUT(&lt;B&gt;%quote('CORRA_&amp;amp;i')&lt;/B&gt;, trim(left(put(DEPEN&amp;amp;i,5.3))));&lt;BR /&gt;
...&lt;BR /&gt;
%end;&lt;BR /&gt;
&lt;BR /&gt;
When the program runs, I want the result to be&lt;BR /&gt;
CALL SYMPUT('CORRA_1', trim(left(...)));&lt;BR /&gt;
CALL SYMPUT('CORRA_2', trim(left(...)));&lt;BR /&gt;
CALL SYMPUT('CORRA_3', trim(left(...)));&lt;BR /&gt;
CALL SYMPUT('CORRA_4', trim(left(...)));&lt;BR /&gt;
&lt;BR /&gt;
But I cannot for the life of me work out how to correctly resolve this. I'm either receiving notes in my log that my variable is uninitialised, or that the 'Apparent Symbolic Reference is not resolved'. In any case, when I use %PUT _USER_; later on, the variables are still equal to 9999.&lt;BR /&gt;
&lt;BR /&gt;
What should I put in place of the bold text to make this work?&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.</description>
      <pubDate>Fri, 01 Dec 2006 13:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Using-CALL-SYMPUT-with-a-macro-name-that-contains-a-variable/m-p/1875#M111</guid>
      <dc:creator>Colxfile</dc:creator>
      <dc:date>2006-12-01T13:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using CALL SYMPUT with a macro name that contains a variable</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Using-CALL-SYMPUT-with-a-macro-name-that-contains-a-variable/m-p/1876#M112</link>
      <description>Hi,&lt;BR /&gt;
Run this test. [pre]&lt;BR /&gt;
%let i = 5;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
depen5 = 64.3;&lt;BR /&gt;
CALL SYMPUT("CORRA_&amp;amp;i", trim(left(put(DEPEN&amp;amp;i,5.3))));&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%put _user_;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 Unless you need the single quotes for something else that was going on in the program, you can replace the %quote function with double quotes and the resolution should be OK.&lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 01 Dec 2006 16:24:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Using-CALL-SYMPUT-with-a-macro-name-that-contains-a-variable/m-p/1876#M112</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2006-12-01T16:24:27Z</dc:date>
    </item>
  </channel>
</rss>

