<?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 Macro variable of second order in a proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134046#M27229</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using a simple sql query with a macro variable in the FROM statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET vormonat = 201303;&lt;/P&gt;&lt;P&gt;%LET dynmonat = vormonat;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-fareast-language: DE; color: black; background: white; font-size: 10pt; font-family: 'Courier New'; mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;create&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;table&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt; &amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;workbib.&lt;STRONG&gt;.i&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;_fdb2bereich &lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;as&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="mso-fareast-language: DE; color: black; background: white; font-size: 10pt; mso-ansi-language: EN-GB; font-family: 'Courier New'; mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;select&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;distinct&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt; bp_bereich, bp_fdb_nr&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="mso-fareast-language: DE; color: black; background: white; font-size: 10pt; mso-ansi-language: EN-GB; font-family: 'Courier New'; mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE;"&gt; lls_com._&amp;amp;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt; mso-fareast-language: DE;"&gt;dynmonat.&lt;STRONG&gt;._&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE;"&gt;EGK_VB_GESAMT&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-fareast-language: DE; color: black; background: white; font-size: 10pt; font-family: 'Courier New'; mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE;"&gt; bp_referenz_nr = &lt;/SPAN&gt;&lt;STRONG style="mso-fareast-language: DE; color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt; mso-fareast-language: DE;"&gt;/* Berater für Basket auswählen */&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt; mso-fareast-language: DE;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1st step:&lt;/P&gt;&lt;P&gt;lls_com._&amp;amp;&amp;amp;&amp;amp;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt;"&gt;dynmonat.&lt;STRONG&gt;._&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;EGK_VB_GESAMT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;&amp;amp; resolves to &amp;amp;&lt;/P&gt;&lt;P&gt;&amp;amp;dynmonat. resolves to vormonat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2nd step: &amp;amp;vormonat._&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;EGK_VB_GESAMT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;I get the error:&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-size: 10pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;45&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;create table &amp;amp;workbib..i_fdb2bereich as&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;46&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;select distinct bp_bereich, bp_fdb_nr&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE;"&gt;47&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;from lls_com._&amp;amp;&amp;amp;&amp;amp;dynmonat.._EGK_VB_GESAMT&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;NOTE: Line generated by the macro variable "DYNMONAT".&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;47&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;lls_com._&amp;amp;Vormonat&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;22&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;76&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, ;, (, ',', ANSIMISS, AS, CROSS, EXCEPT, FULL, GROUP, HAVING, &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;INNER, INTERSECT, JOIN, LEFT, NATURAL, NOMISS, ORDER, OUTER, RIGHT, UNION, WHERE.&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="color: #ff0000; font-size: 10pt; font-family: Courier New;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;Whats wrong?&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;Thx, Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 May 2013 09:13:57 GMT</pubDate>
    <dc:creator>sfmeier</dc:creator>
    <dc:date>2013-05-14T09:13:57Z</dc:date>
    <item>
      <title>Macro variable of second order in a proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134046#M27229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using a simple sql query with a macro variable in the FROM statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET vormonat = 201303;&lt;/P&gt;&lt;P&gt;%LET dynmonat = vormonat;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-fareast-language: DE; color: black; background: white; font-size: 10pt; font-family: 'Courier New'; mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;create&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;table&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt; &amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;workbib.&lt;STRONG&gt;.i&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;_fdb2bereich &lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;as&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="mso-fareast-language: DE; color: black; background: white; font-size: 10pt; mso-ansi-language: EN-GB; font-family: 'Courier New'; mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;select&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;distinct&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt; bp_bereich, bp_fdb_nr&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="mso-fareast-language: DE; color: black; background: white; font-size: 10pt; mso-ansi-language: EN-GB; font-family: 'Courier New'; mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE;"&gt; lls_com._&amp;amp;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt; mso-fareast-language: DE;"&gt;dynmonat.&lt;STRONG&gt;._&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE;"&gt;EGK_VB_GESAMT&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-fareast-language: DE; color: black; background: white; font-size: 10pt; font-family: 'Courier New'; mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE;"&gt; bp_referenz_nr = &lt;/SPAN&gt;&lt;STRONG style="mso-fareast-language: DE; color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt; mso-fareast-language: DE;"&gt;/* Berater für Basket auswählen */&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt; mso-fareast-language: DE;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1st step:&lt;/P&gt;&lt;P&gt;lls_com._&amp;amp;&amp;amp;&amp;amp;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt;"&gt;dynmonat.&lt;STRONG&gt;._&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;EGK_VB_GESAMT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;&amp;amp; resolves to &amp;amp;&lt;/P&gt;&lt;P&gt;&amp;amp;dynmonat. resolves to vormonat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2nd step: &amp;amp;vormonat._&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;EGK_VB_GESAMT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;I get the error:&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-size: 10pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;45&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;create table &amp;amp;workbib..i_fdb2bereich as&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;46&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;select distinct bp_bereich, bp_fdb_nr&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE;"&gt;47&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;from lls_com._&amp;amp;&amp;amp;&amp;amp;dynmonat.._EGK_VB_GESAMT&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;NOTE: Line generated by the macro variable "DYNMONAT".&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;47&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;lls_com._&amp;amp;Vormonat&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;22&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;76&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, ;, (, ',', ANSIMISS, AS, CROSS, EXCEPT, FULL, GROUP, HAVING, &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;INNER, INTERSECT, JOIN, LEFT, NATURAL, NOMISS, ORDER, OUTER, RIGHT, UNION, WHERE.&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="color: #ff0000; font-size: 10pt; font-family: Courier New;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;Whats wrong?&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;Thx, Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 09:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134046#M27229</guid>
      <dc:creator>sfmeier</dc:creator>
      <dc:date>2013-05-14T09:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable of second order in a proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134047#M27230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;There is extra dot in your FROM clause of Proc Sql...I have removed it below...Try it...And you don't need indirect reference of macro variables in this case...It simply runs with singal &amp;amp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;FROM &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;lls_com_&amp;amp;vormonat&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt;"&gt;.&lt;STRONG&gt;._&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;EGK_VB_GESAMT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;-Urvish&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 10:46:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134047#M27230</guid>
      <dc:creator>UrvishShah</dc:creator>
      <dc:date>2013-05-14T10:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable of second order in a proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134048#M27231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have no trouble using this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%LET vormonat = 201303;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%LET dynmonat = vormonat;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%put lls_com._&amp;amp;&amp;amp;&amp;amp;dynmonat.._EGK_VB_GESAMT;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps your actual macro variable values are quoted in some way that is confusing the SAS parser?&lt;/P&gt;&lt;P&gt;Try wrapping the table name with %UNQUOTE() .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%unquote(lls_com._&amp;amp;&amp;amp;&amp;amp;dynmonat.._EGK_VB_GESAMT)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 11:08:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134048#M27231</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-05-14T11:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable of second order in a proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134049#M27232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Urvish,&lt;/P&gt;&lt;P&gt;thank you for your reponse. I need the dot after lls_com because lls_com is the library. If course I dont need the indirect reference in the simplified code I posted, but the "&lt;SPAN style="font-family: 'courier new', courier;"&gt;%LET dynmonat = vormonat;" Statement is usually more complex. I just simplified it because it is not necessary to solve this problem. Any other ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Stefan&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 11:28:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134049#M27232</guid>
      <dc:creator>sfmeier</dc:creator>
      <dc:date>2013-05-14T11:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable of second order in a proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134050#M27233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE;"&gt;Hi Tom,&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt; &lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE;"&gt;thank you for your fast response and an important clue. Your ....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; %put lls_com._&amp;amp;&amp;amp;&amp;amp;dynmonat.._EGK_VB_GESAMT;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (1)&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE;"&gt;... produces the following result in my code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE;"&gt;lls_com._&amp;amp;Vormonat._EGK_VB_GESAMT&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt;"&gt; &lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE;"&gt;So I think, the error comes from an earlier part of my code which you can see here:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE;"&gt;%LET Stichtag = 20130131; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE;"&gt; Stichdatum = &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE;"&gt;(INPUTN(&amp;amp;stichtag, B8601DA.));&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt; Vormonat = &lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;(INTNX(Month, &amp;amp;stichdatum, -1), YYMMN.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;The Macro variable VORMONAT seems correctly used: &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;SYMBOLGEN:&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;Macro variable VORMONAT resolves to 201301&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;Any ideas why my &amp;amp;Vormonat does not resolve to 201301 in (1)?&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 11:53:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134050#M27233</guid>
      <dc:creator>sfmeier</dc:creator>
      <dc:date>2013-05-14T11:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable of second order in a proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134051#M27234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;btw: the&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%unquote(lls_com._&amp;amp;&amp;amp;&amp;amp;dynmonat.._EGK_VB_GESAMT)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;works!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but perhaps you could explain me why?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 12:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134051#M27234</guid>
      <dc:creator>sfmeier</dc:creator>
      <dc:date>2013-05-14T12:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable of second order in a proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134052#M27235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do not know why, but sometimes SAS will see a token break in the middle of a word when you are generating them by pieces with macro logic.&lt;/P&gt;&lt;P&gt;So by wrapping it in an %unquote() the base SAS language parser will see the whole string as one token.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 13:12:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134052#M27235</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-05-14T13:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable of second order in a proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134053#M27236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh.. ok.. thx!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 13:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-of-second-order-in-a-proc-sql/m-p/134053#M27236</guid>
      <dc:creator>sfmeier</dc:creator>
      <dc:date>2013-05-14T13:20:27Z</dc:date>
    </item>
  </channel>
</rss>

