<?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 Adding the string in macro variable separated by comma in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Adding-the-string-in-macro-variable-separated-by-comma/m-p/727333#M226196</link>
    <description>&lt;P&gt;I've the macro variable as below. Now I want to create one more macro variable by using this macro variable 'Meta_Col' and I want to add the string &lt;STRONG&gt;meta. &lt;/STRONG&gt;to the value in the macro variable Meta_Col&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let Meta_Col=businessDataName,reportingArea,reportingDate,reportingPurpose;&lt;/PRE&gt;
&lt;P&gt;Desired Result is to create one macro variable (e.g. Meta_new_Col)&amp;nbsp;and it should have value as below. Any help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;meta.businessDataName,meta.reportingArea,meta.reportingDate,meta.reportingPurpose&lt;/PRE&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Mar 2021 09:25:06 GMT</pubDate>
    <dc:creator>David_Billa</dc:creator>
    <dc:date>2021-03-18T09:25:06Z</dc:date>
    <item>
      <title>Adding the string in macro variable separated by comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-the-string-in-macro-variable-separated-by-comma/m-p/727333#M226196</link>
      <description>&lt;P&gt;I've the macro variable as below. Now I want to create one more macro variable by using this macro variable 'Meta_Col' and I want to add the string &lt;STRONG&gt;meta. &lt;/STRONG&gt;to the value in the macro variable Meta_Col&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let Meta_Col=businessDataName,reportingArea,reportingDate,reportingPurpose;&lt;/PRE&gt;
&lt;P&gt;Desired Result is to create one macro variable (e.g. Meta_new_Col)&amp;nbsp;and it should have value as below. Any help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;meta.businessDataName,meta.reportingArea,meta.reportingDate,meta.reportingPurpose&lt;/PRE&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 09:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-the-string-in-macro-variable-separated-by-comma/m-p/727333#M226196</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2021-03-18T09:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Adding the string in macro variable separated by comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-the-string-in-macro-variable-separated-by-comma/m-p/727334#M226197</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Meta_Col=businessDataName,reportingArea,reportingDate,reportingPurpose;

data _null_;
meta_col = "&amp;amp;meta_col.";
length meta_new_col $1000;
do i = 1 to countw(meta_col,",");
  meta_new_col = catx(",",meta_new_col,"meta."!!scan(meta_col,i,","));
end;
call symputx("meta_new_col",meta_new_col);
run;

%put &amp;amp;=meta_new_col;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Mar 2021 09:34:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-the-string-in-macro-variable-separated-by-comma/m-p/727334#M226197</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-18T09:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: Adding the string in macro variable separated by comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-the-string-in-macro-variable-separated-by-comma/m-p/727351#M226201</link>
      <description>&lt;P&gt;Alternatively, you can use a combination of functions:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Meta_new_Col=meta.%sysfunc(tranwrd(%quote(&amp;amp;meta_col),%str(,),%str(,meta.)));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Mar 2021 10:23:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-the-string-in-macro-variable-separated-by-comma/m-p/727351#M226201</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-03-18T10:23:56Z</dc:date>
    </item>
  </channel>
</rss>

