<?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 % LET STATEMENT in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/LET-STATEMENT/m-p/848668#M335518</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am facing some issues with the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let num =5;&lt;/P&gt;&lt;P&gt;%let a&amp;amp;num = alpino;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want that a&amp;amp;num resolves to a5 = alpino but I am not getting the expected result. Does anyone have an answer to solve this. Regards&lt;/P&gt;</description>
    <pubDate>Thu, 08 Dec 2022 23:27:38 GMT</pubDate>
    <dc:creator>latristain</dc:creator>
    <dc:date>2022-12-08T23:27:38Z</dc:date>
    <item>
      <title>% LET STATEMENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LET-STATEMENT/m-p/848668#M335518</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am facing some issues with the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let num =5;&lt;/P&gt;&lt;P&gt;%let a&amp;amp;num = alpino;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want that a&amp;amp;num resolves to a5 = alpino but I am not getting the expected result. Does anyone have an answer to solve this. Regards&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 23:27:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LET-STATEMENT/m-p/848668#M335518</guid>
      <dc:creator>latristain</dc:creator>
      <dc:date>2022-12-08T23:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: % LET STATEMENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LET-STATEMENT/m-p/848671#M335520</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/169873"&gt;@latristain&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am facing some issues with the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have this code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let num =5;&lt;/P&gt;
&lt;P&gt;%let a&amp;amp;num = alpino;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want that a&amp;amp;num resolves to a5 = alpino but I am not getting the expected result. Does anyone have an answer to solve this. Regards&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not sure what you mean.&amp;nbsp; Here is what you ran.&lt;/P&gt;
&lt;PRE&gt;134  %let num =5;
135
136  %let a&amp;amp;num = alpino;
137  %put &amp;amp;=a5 ;
A5=alpino
&lt;/PRE&gt;
&lt;P&gt;If you want the value to also include value of num then say that in the assignment statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;138  %let num =5;
139
140  %let a&amp;amp;num = a&amp;amp;num = alpino;
141  %put &amp;amp;=a5 ;
A5=a5 = alpino
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I suspect that what you did was something different than what you showed.&lt;/P&gt;
&lt;P&gt;For example you might have generated NUM to include leading spaces.&lt;/P&gt;
&lt;PRE&gt;146  data _null_;
147    call symput('num',5);
148  run;

NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
      147:21
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


149  %put NUM="&amp;amp;num";
NUM="           5"
&lt;/PRE&gt;
&lt;P&gt;Which will cause trouble with your other %LET statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure not to generate the spaces into the macro variable.&amp;nbsp; For example by using the normal CALL SYMPUTX() function instead of the ancient CALL SYMPUT() function.&lt;/P&gt;
&lt;PRE&gt;150  data _null_;
151    call symputX('num',5);
152  run;

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


153  %put NUM="&amp;amp;num";
NUM="5"
&lt;/PRE&gt;
&lt;P&gt;Or adding the TRIMMED keyword in PROC SQL code used to generate a macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 00:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LET-STATEMENT/m-p/848671#M335520</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-12-09T00:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: % LET STATEMENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LET-STATEMENT/m-p/848672#M335521</link>
      <description>&lt;P&gt;This is an indirect reference. You can either use multiple ampersands or %SUPERQ to make this work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let num =5;
%let a&amp;amp;num = alpino;
%put NOTE: The variable names and values are &amp;amp;=num &amp;amp;=a5;
%PUT NOTE: The value retrieved with %NRSTR(%%SUPERQ%(A&amp;amp;NUM%)) is %superq(a&amp;amp;num);
%PUT NOTE: The value retrieved with %NRSTR(&amp;amp;&amp;amp;A&amp;amp;NUM) is &amp;amp;&amp;amp;a&amp;amp;num;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;produces these notes in the log:&lt;/P&gt;
&lt;PRE&gt; NOTE: The variable names and values are NUM=5 A5=alpino
 NOTE: The value retrieved with %SUPERQ(A&amp;amp;NUM) is alpino
 NOTE: The value retrieved with &amp;amp;&amp;amp;A&amp;amp;NUM is alpino&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 00:19:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LET-STATEMENT/m-p/848672#M335521</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2022-12-09T00:19:46Z</dc:date>
    </item>
  </channel>
</rss>

