<?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 keyword LET appears as text in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25504#M4468</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Macrovariable values have a maximum length of 65,534 characters, your 1500 accounts are using up all that space and there is no option to increase that size. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you define the macro variables within the macro then they disappear when that macro is finished and you can't call them outside of the macro. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the %global statement to define the macro. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ERROR message is an indicator, you have shown how you're calling the macro variables so we can't tell you if you have another error or not. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here some info on macro variable scope:&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a001072111.htm#a001072130"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a001072111.htm#a001072130&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the scope of your variables by using some %put statements inside your macro and outside.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%MACRO FORMAT_DATASET(LIB=,TABLE=);&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;PROC DATASETS LIBRARY=&amp;amp;LIB;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DELETE &amp;amp;TABLE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;RUN;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DATA &amp;amp;LIB..LISTFILE(DROP=ACCT_NBR);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;SET &amp;amp;LIB..&amp;amp;TABLE(KEEP=ACCT_NBR);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;FORMAT ACCT_NBR_MQ $QUOTE20. ACCT_NBR_DQ $QUOTE24.;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ACCT_NBR_MQ=PUT(INPUT(ACCT_NBR,22.),Z18.);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ACCT_NBR_DQ=PUT(INPUT(ACCT_NBR,22.),Z22.);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;RUN;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;PROC SQL;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;SELECT ACCT_NBR_DQ INTO :ACCT_NBR_DQ SEPARATED BY "," FROM &amp;amp;LIB..LISTFILE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;SELECT ACCT_NBR_MQ INTO :ACCT_NBR_MQ SEPARATED BY "," FROM &amp;amp;LIB..LISTFILE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;QUIT;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%LET ACCT_NBR_D=%SYSFUNC(TRANWRD(%BQUOTE(&amp;amp;ACCT_NBR_DQ),%BQUOTE("),%BQUOTE(')));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%LET ACCT_NBR_M=%SYSFUNC(TRANWRD(%BQUOTE(&amp;amp;ACCT_NBR_MQ),%BQUOTE("),%BQUOTE(')));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%put &amp;amp;&lt;/STRONG&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ACCT_NBR_D.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%put &amp;amp;&lt;/STRONG&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ACCT_NBR_M.;&lt;/STRONG&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%MEND FORMAT_DATASET;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%put &amp;amp;&lt;/STRONG&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ACCT_NBR_D.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%put &amp;amp;&lt;/STRONG&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ACCT_NBR_M.;&lt;/STRONG&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Jan 2012 22:21:59 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2012-01-06T22:21:59Z</dc:date>
    <item>
      <title>Macro keyword LET appears as text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25501#M4465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;Hi All,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;I am in the process of setting up auto call macro library for my project. As part of that I have created macro module which will read the dataset and format the account number present in the dataset and store it in two different variable ACCT_NBR_M ($18.) and ACCT_NBR_D ($22.). Actually these two formats are to used to query different tables.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;Finally I am putting all the account number into a single macro variable, which I can use it in my where condition like this where account_num in (&amp;amp;acct_nbr_m);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;Below is the code I am using to do the above step. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%MACRO FORMAT_DATASET(LIB=,TABLE=);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;PROC DATASETS LIBRARY=&amp;amp;LIB;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DELETE &amp;amp;TABLE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;RUN;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DATA &amp;amp;LIB..LISTFILE(DROP=ACCT_NBR);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;SET &amp;amp;LIB..&amp;amp;TABLE(KEEP=ACCT_NBR);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;FORMAT ACCT_NBR_MQ $QUOTE20. ACCT_NBR_DQ $QUOTE24.;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ACCT_NBR_MQ=PUT(INPUT(ACCT_NBR,22.),Z18.);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ACCT_NBR_DQ=PUT(INPUT(ACCT_NBR,22.),Z22.);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;RUN;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;PROC SQL;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;SELECT ACCT_NBR_DQ INTO :ACCT_NBR_DQ SEPARATED BY "," FROM &amp;amp;LIB..LISTFILE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;SELECT ACCT_NBR_MQ INTO :ACCT_NBR_MQ SEPARATED BY "," FROM &amp;amp;LIB..LISTFILE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;QUIT;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%LET ACCT_NBR_D=%SYSFUNC(TRANWRD(%BQUOTE(&amp;amp;ACCT_NBR_DQ),%BQUOTE("),%BQUOTE(')));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%LET ACCT_NBR_M=%SYSFUNC(TRANWRD(%BQUOTE(&amp;amp;ACCT_NBR_MQ),%BQUOTE("),%BQUOTE(')));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%MEND FORMAT_DATASET;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;The code works perfectly with out putting them inside macro, but when I placed them inside the %macro %mend and try to access them from some other location, I am getting the following error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: courier new,courier;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-family: courier new,courier;"&gt;ERROR: Macro keyword LET appears as text.&amp;nbsp; A semicolon or other delimiter may be missing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-family: courier new,courier;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; color: #333333; font-family: calibri, verdana, arial, sans-serif;"&gt;Am I missing anything when I place the code inside the %macro and %mend. Please help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; color: #333333; font-family: calibri, verdana, arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; color: #333333; font-family: calibri, verdana, arial, sans-serif;"&gt;In the same program I have another question, the macro variable ACCT_NBR_M is not holding more than 1500+ accounts. Do we have any option in SAS to expand the macro variable storage length.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; color: #333333; font-family: calibri, verdana, arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; color: #333333; font-family: calibri, verdana, arial, sans-serif;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; color: #333333; font-family: calibri, verdana, arial, sans-serif;"&gt;Dhanasekaran R&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; color: #333333; font-family: courier new,courier;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2012 21:00:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25501#M4465</guid>
      <dc:creator>dhana</dc:creator>
      <dc:date>2012-01-06T21:00:57Z</dc:date>
    </item>
    <item>
      <title>Macro keyword LET appears as text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25502#M4466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do not see any statement declaring ACCT_NBR_D and ACCT_NBR_M as global or local macro variables.&lt;/P&gt;&lt;P&gt;This means that your macro will work differently depending if those macro variables have been defined before the macro is called.&lt;/P&gt;&lt;P&gt;If they have not been defined then they will be made local and will disappear when %FORMAT_DATASET macro exists.&lt;/P&gt;&lt;P&gt;If they have been defined then the macro will change their values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2012 21:13:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25502#M4466</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-01-06T21:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Macro keyword LET appears as text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25503#M4467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;You&amp;nbsp; mean to say that in the program where I am calling this macro %FORMAT_DATASET, I should declare %GLOBAL ACCT_NBR_D; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;%GLOBAL ACCT_NBR_M;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;But the Error message looks to be a problem with the %LET statement.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;Dhanasekaran R&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2012 21:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25503#M4467</guid>
      <dc:creator>dhana</dc:creator>
      <dc:date>2012-01-06T21:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Macro keyword LET appears as text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25504#M4468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Macrovariable values have a maximum length of 65,534 characters, your 1500 accounts are using up all that space and there is no option to increase that size. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you define the macro variables within the macro then they disappear when that macro is finished and you can't call them outside of the macro. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the %global statement to define the macro. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ERROR message is an indicator, you have shown how you're calling the macro variables so we can't tell you if you have another error or not. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here some info on macro variable scope:&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a001072111.htm#a001072130"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a001072111.htm#a001072130&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the scope of your variables by using some %put statements inside your macro and outside.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%MACRO FORMAT_DATASET(LIB=,TABLE=);&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;PROC DATASETS LIBRARY=&amp;amp;LIB;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DELETE &amp;amp;TABLE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;RUN;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DATA &amp;amp;LIB..LISTFILE(DROP=ACCT_NBR);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;SET &amp;amp;LIB..&amp;amp;TABLE(KEEP=ACCT_NBR);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;FORMAT ACCT_NBR_MQ $QUOTE20. ACCT_NBR_DQ $QUOTE24.;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ACCT_NBR_MQ=PUT(INPUT(ACCT_NBR,22.),Z18.);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ACCT_NBR_DQ=PUT(INPUT(ACCT_NBR,22.),Z22.);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;RUN;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;PROC SQL;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;SELECT ACCT_NBR_DQ INTO :ACCT_NBR_DQ SEPARATED BY "," FROM &amp;amp;LIB..LISTFILE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;SELECT ACCT_NBR_MQ INTO :ACCT_NBR_MQ SEPARATED BY "," FROM &amp;amp;LIB..LISTFILE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;QUIT;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%LET ACCT_NBR_D=%SYSFUNC(TRANWRD(%BQUOTE(&amp;amp;ACCT_NBR_DQ),%BQUOTE("),%BQUOTE(')));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%LET ACCT_NBR_M=%SYSFUNC(TRANWRD(%BQUOTE(&amp;amp;ACCT_NBR_MQ),%BQUOTE("),%BQUOTE(')));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%put &amp;amp;&lt;/STRONG&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ACCT_NBR_D.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%put &amp;amp;&lt;/STRONG&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ACCT_NBR_M.;&lt;/STRONG&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%MEND FORMAT_DATASET;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%put &amp;amp;&lt;/STRONG&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ACCT_NBR_D.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%put &amp;amp;&lt;/STRONG&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ACCT_NBR_M.;&lt;/STRONG&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2012 22:21:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25504#M4468</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-01-06T22:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Macro keyword LET appears as text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25505#M4469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I could replicate what you describe and I believe what you observe is caused by incorrect quoting of unmatched quotation marks. You need to use a % in front of the quotation mark like documented:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a001061290.htm"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a001061290.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would use %str() so your statements would look like:&lt;/P&gt;&lt;P&gt;%LET ACCT_NBR_D=%SYSFUNC(TRANWRD(%BQUOTE(&amp;amp;ACCT_NBR_DQ),%str(%"),%str(%')));&lt;/P&gt;&lt;P&gt;%LET ACCT_NBR_M=%SYSFUNC(TRANWRD(%BQUOTE(&amp;amp;ACCT_NBR_MQ),%str(%"),%str(%')));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Macro vars store up to 32K (or 64K on 64bit OS - not sure if true for all 64bit OS).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2012 22:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25505#M4469</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-01-06T22:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro keyword LET appears as text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25506#M4470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have received help on the issues of generating single quote characters that should help a little with your problem.&lt;/P&gt;&lt;P&gt;Your largest issue is the one you listed last.&amp;nbsp; There is a limit to the number of characters that can be stored in a macro variable.&amp;nbsp; &lt;/P&gt;&lt;P&gt;So you need to look at your process and decide how you want to handle that.&amp;nbsp; In general you might want to modify your process to use a dataset instead of a macro variable to pass the list of account numbers.&amp;nbsp; Of course this might cause other trouble, for example look at this thread on subsetting data from Teradata tables. (&lt;A _jive_internal="true" href="https://communities.sas.com/message/112731#112731"&gt;http://communities.sas.com/message/112731#112731&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your macro also has some other logic and coding errors.&lt;/P&gt;&lt;P&gt;1) You delete the input dataset before you use it.&lt;/P&gt;&lt;P&gt;2) You are defining character variables that are two spaces longer than you need.&amp;nbsp; This is because the first reference to the variables is the format statement.&amp;nbsp; So it uses the length of the format for the length of the variables.&amp;nbsp; You could add a length statement before the format statement to fix that.&lt;/P&gt;&lt;P&gt;3) You could eliminate your problem with the macro quoting of single quotes by just doing it in basic SAS statements instead.&amp;nbsp; For example you could build the macro variables directly from the input numeric variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;PROC SQL noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SELECT "'"||put(ACCT_NBR,z18.)||"'"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , &lt;SPAN style="font-family: monospace; white-space: pre; background-color: #ffffff;"&gt;"'"||put(ACCT_NBR,z22.)||"'"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO :ACCT_NBR_DQ SEPARATED BY "," &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; white-space: pre; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , :ACCT_NBR_MQ SEPARATED BY "," &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM &amp;amp;LIB..&amp;amp;TABLE&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) Because your strings are fixed length it would be easy to test if your query would generate a macro variable that is too long.&lt;/P&gt;&lt;P&gt;%if %sysevalf( &amp;amp;sqlobs*25 &amp;gt; 65534) %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %put ERROR: Too many accounts selected to for macro variable generation.&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Jan 2012 16:29:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25506#M4470</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-01-07T16:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Macro keyword LET appears as text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25507#M4471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;Thanks a lot Tom...! Actually I noticed and corrected couple of errors that you have mentioned here while I was running the program.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;I have learned a new way of creating account numbers with quotes, thanks a lot for that.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;I will test this and get back to you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;Dhana&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 19:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25507#M4471</guid>
      <dc:creator>dhana</dc:creator>
      <dc:date>2012-01-10T19:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Macro keyword LET appears as text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25508#M4472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Patrick...! This actually solved my probelm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reagrds&lt;/P&gt;&lt;P&gt;Dhana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 19:05:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-keyword-LET-appears-as-text/m-p/25508#M4472</guid>
      <dc:creator>dhana</dc:creator>
      <dc:date>2012-01-10T19:05:51Z</dc:date>
    </item>
  </channel>
</rss>

