<?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 remove quotes from macro and remove commas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817746#M322773</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Let's say that user define a macro var called vector1 that contain values separated by comma.&lt;/P&gt;
&lt;P&gt;The task is to create another macro variable called vector2 that contain same values as vector 1 but values separated by space and also the values shouldn't be quoted .&lt;/P&gt;
&lt;P&gt;What is the way to do it please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Vector1='RFA07','RFA02','RFA04','BRG92','PER1903';
/*Task-Create macro variable Vector2 that will be equal to
 RFA07 RFA02 RFA04 BRG92 PER1903*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 13 Jun 2022 10:32:06 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2022-06-13T10:32:06Z</dc:date>
    <item>
      <title>remove quotes from macro and remove commas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817746#M322773</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Let's say that user define a macro var called vector1 that contain values separated by comma.&lt;/P&gt;
&lt;P&gt;The task is to create another macro variable called vector2 that contain same values as vector 1 but values separated by space and also the values shouldn't be quoted .&lt;/P&gt;
&lt;P&gt;What is the way to do it please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Vector1='RFA07','RFA02','RFA04','BRG92','PER1903';
/*Task-Create macro variable Vector2 that will be equal to
 RFA07 RFA02 RFA04 BRG92 PER1903*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jun 2022 10:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817746#M322773</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2022-06-13T10:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: remove quotes from macro and remove commas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817748#M322775</link>
      <description>&lt;P&gt;well we just showed you how to remove spaces in your other post.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 10:36:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817748#M322775</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2022-06-13T10:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: remove quotes from macro and remove commas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817749#M322776</link>
      <description>&lt;P&gt;True&amp;nbsp; but now need to do 2 actions :&lt;/P&gt;
&lt;P&gt;remove comma and remove quotes.&lt;/P&gt;
&lt;P&gt;I have tried fist to remove the single quotes but I received an error&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 10:57:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817749#M322776</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2022-06-13T10:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: remove quotes from macro and remove commas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817750#M322777</link>
      <description>&lt;P&gt;Please see the error&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Vector1=
'RFA01',
	'RFA07',
	'RFA02',
	'RFA03',
	'RFA04',
	'RFA05',
	'RFB01',
	'RFB02',
	'RFB04',
	'RFB09', 
	'RFB05',
	'RFB06',
	'RFB07',
	'RFB08';

%let Vector2 = %qsysfunc(compress(&amp;amp;Vector1,%str(%')));
ERROR: The function COMPRESS referenced by the %SYSFUNC or %QSYSFUNC macro function has too many arguments.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jun 2022 10:52:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817750#M322777</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2022-06-13T10:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: remove quotes from macro and remove commas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817751#M322778</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Vector1=
'RFA01',
	'RFA07',
	'RFA02',
	'RFA03',
	'RFA04',
	'RFA05',
	'RFB01',
	'RFB02',
	'RFB04',
	'RFB09', 
	'RFB05',
	'RFB06',
	'RFB07',
	'RFB08';

%let Vector2 = %qsysfunc(compress((&amp;amp;Vector1),%str((%'))));
%put &amp;amp;=Vector2.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 11:09:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817751#M322778</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2022-06-13T11:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: remove quotes from macro and remove commas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817753#M322780</link>
      <description>&lt;P&gt;you need to wrap &amp;amp;vector1 with %quote().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Vector1='RFA07','RFA02','RFA04','BRG92','PER1903';
%let Vector2 = %qsysfunc(compress(%quote(&amp;amp;vector1),%str(%')));
%put &amp;amp;=vector2;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jun 2022 11:15:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817753#M322780</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2022-06-13T11:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: remove quotes from macro and remove commas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817754#M322781</link>
      <description>&lt;P&gt;just do it in 2 steps&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Vector1='RFA07','RFA02','RFA04','BRG92','PER1903';
%let Vector2 = %qsysfunc(compress(%quote(&amp;amp;vector1),%str(%')));
%let vector2 = %sysfunc(tranwrd(%quote(&amp;amp;vector2),%str(,),%str()));
%put &amp;amp;=vector2;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jun 2022 11:20:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817754#M322781</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2022-06-13T11:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: remove quotes from macro and remove commas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817757#M322784</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Vector1='RFA07','RFA02','RFA04','BRG92','PER1903';
%let vector2=%sysfunc(translate(%quote(&amp;amp;vector1),%str(  ),%str(%',)));
%put &amp;amp;=vector1;
%put &amp;amp;=vector2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The second percent sign in %str(%',) is needed to indicate to the macro processor that this is text that is a single unmatched quote. The comma following is also needed as you want to convert both single quote and comma to blanks. See&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/mcrolref/n09tblrxldh8k0n1kt6dkj3xlxug.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmmvacdc/9.4/mcrolref/n09tblrxldh8k0n1kt6dkj3xlxug.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 11:35:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-quotes-from-macro-and-remove-commas/m-p/817757#M322784</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-13T11:35:38Z</dc:date>
    </item>
  </channel>
</rss>

