<?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 concatenate in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-concatenate/m-p/330324#M74068</link>
    <description>&lt;P&gt;You know that SAS allows you develop your own custom intervals and use that in functions such as INTNX and such?&lt;/P&gt;
&lt;P&gt;It isn't as easy as I'd like but it seems easier than what you're doing &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The specific example starts on page 5&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings15/2460-2015.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings15/2460-2015.pdf&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Feb 2017 21:45:19 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-02-06T21:45:19Z</dc:date>
    <item>
      <title>macro variable concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-concatenate/m-p/330286#M74042</link>
      <description>&lt;P&gt;I'm going crazy about my inaptitude to make this code run:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not succeed in creating the macro variables ARGUMENT1, ARGUMENT2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to concatenate the WORD ARGUMENT with the index of the loop and then execute...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; TEST100;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; TEST &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;END&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=FINAL;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CALL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SYMPUT(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"ARGUMENT"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;||COMPRESS(_N_),CATX(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;","&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, COMMITTEE,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CALL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SYMPUT(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"NOPS"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,COMPRESS(_N_));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;IF&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; FINAL &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; I=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;TO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;NOPS; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT face="Courier New" size="3"&gt;CALL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; EXECUTE (&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;'%TEST_DATE("&amp;amp;&amp;amp;ARGUMENT&amp;amp;I")'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* COMMITTEE=COMMITTEE - &amp;amp;DAYSBACK; */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;END&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;END&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; TEST ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; MAKE $ COMMITTEE &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ROUND $ ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; COMMITTEE &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;weekdate17.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;cards&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;VW 10APR2017 1ST&lt;/P&gt;&lt;P&gt;LCV 13APR2017 1ST&lt;/P&gt;&lt;P&gt;SKODA 14MAY2017 1ST&lt;/P&gt;&lt;P&gt;AUDI 10JUL2017 1ST&lt;/P&gt;&lt;P&gt;SEAT 01JUN2017 1ST&lt;/P&gt;&lt;P&gt;VW 23OCT2017 2ND&lt;/P&gt;&lt;P&gt;LCV 02OCT2017 2ND&lt;/P&gt;&lt;P&gt;SKODA 24NOV2017 2ND&lt;/P&gt;&lt;P&gt;AUDI 24DEC2017 2ND&lt;/P&gt;&lt;P&gt;SEAT 17NOV2017 2ND&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%PUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;WDAYS;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OPTIONS&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;MLOGIC&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;MPRINT&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;MINOPERATOR&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SYMBOLGEN&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%MACRO&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; TEST_DATE(DATE, VORLAUF);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%GLOBAL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; DAYSBACK;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%LET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; C=0;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%LET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; N=0;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%DO&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%UNTIL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; (&amp;amp;N=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; );&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%IF&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; (&amp;amp;DATE-&amp;amp;C) IN (&amp;amp;wdays) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%THEN&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%LET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; N=1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%LET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; DAYSBACK=&amp;amp;C;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%END&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%LET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; C=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%EVAL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(&amp;amp;C+1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%END&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%MEND&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 19:44:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-concatenate/m-p/330286#M74042</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2017-02-06T19:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-concatenate/m-p/330295#M74047</link>
      <description>&lt;P&gt;What is the PURPOSE of this macro?&lt;/P&gt;
&lt;PRE&gt;%MACRO TEST_DATE(DATE, VORLAUF);
DATA _NULL_;
%GLOBAL DAYSBACK;
%LET C=0;
%LET N=0;
%DO %UNTIL (&amp;amp;N=1 );
%IF (&amp;amp;DATE-&amp;amp;C) IN (&amp;amp;wdays) %THEN %DO;
%LET N=1;
%LET DAYSBACK=&amp;amp;C;
%END;
%LET C=%EVAL(&amp;amp;C+1);
%END;
RUN;
%MEND;
&lt;/PRE&gt;
&lt;P&gt;The data _null_&amp;nbsp; / run; is not going to do anything as the rest is all macro code. Where is &amp;amp;wdays going to come from?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the purpose is to adjust a date value by a a number of days then you should investigate the INTNX function to do that directly instead of some ugly looping code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also calling macro variables in the same datastep that creates them is problematic at best, usually doesn't work.&lt;/P&gt;
&lt;P&gt;After calling you macro in a loop the only value that would remain would be last generated value for DAYSBACK, so the loop makes little sense and this should do most of the same:&lt;/P&gt;
&lt;PRE&gt;DATA _null_;
SET TEST END=FINAL;
CALL EXECUTE ('%TEST_DATE('||committee||',0)');
RUN;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Feb 2017 20:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-concatenate/m-p/330295#M74047</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-06T20:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-concatenate/m-p/330306#M74055</link>
      <description>&lt;P&gt;Thanks, &amp;amp;wdays holds working days of 2017.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to check with the data _null_ if the dates coming from the dataset are valid working days.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If not, the macro with the global variable daysback returns how many days I have to advance the meeting in order to coincide with a working day.&lt;/P&gt;&lt;P&gt;I could write this row-specific value for daysback to a macro variable and use it in a data step for adjusting the original date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have resolved this specific issue within a data step and it works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Therefore here the question&amp;nbsp;if it makes sense or not, is not so important for me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Generally speaking I want to know how I can access a logic, here in format of a macro, &amp;nbsp;within a data step. I had heard of FCMP but I wonder if it's possible, feasible, recommendable to do it like I am trying here...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And more concrete I want to know how I can build the macro variable Argument1 by concatenating ARGUMENT and the DO-LOOP index.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 20:33:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-concatenate/m-p/330306#M74055</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2017-02-06T20:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-concatenate/m-p/330316#M74062</link>
      <description>&lt;P&gt;Did you try somthing like %put &amp;amp;argument1 after the data step?&lt;/P&gt;
&lt;PRE&gt;DATA _null_;
   committee='Some text';
   CALL SYMPUT("ARGUMENT"||COMPRESS(_N_),CATX(",", COMMITTEE,0));
RUN;
%put &amp;amp;Argument1;
&lt;/PRE&gt;
&lt;P&gt;The argument variable was created just fine. It is the use inside the same data step that creates it that is problematic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unless you have a very complex definition of "workday" you may find that the existing date functions such as WEEKDAY and HOLIDAY may be easier to program and maintain.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 21:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-concatenate/m-p/330316#M74062</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-06T21:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable concatenate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-concatenate/m-p/330324#M74068</link>
      <description>&lt;P&gt;You know that SAS allows you develop your own custom intervals and use that in functions such as INTNX and such?&lt;/P&gt;
&lt;P&gt;It isn't as easy as I'd like but it seems easier than what you're doing &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The specific example starts on page 5&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings15/2460-2015.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings15/2460-2015.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 21:45:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-concatenate/m-p/330324#M74068</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-06T21:45:19Z</dc:date>
    </item>
  </channel>
</rss>

