<?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: Add double quoutes between text in macro varible in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759107#M239819</link>
    <description>&lt;P&gt;I agree, although if one feels the need to understand the code, qlist is perhaps more complicated, and some of the comments don't make sense, at least to me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why is there a comment in front of &amp;amp;rp in this code?&amp;nbsp; I see what &amp;amp;rp is doing, but I don't understand why that comment would be necessary, although I have not played with the code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%*----------------------------------------------------------------------
Add parentheses when requested.
-----------------------------------------------------------------------;
%*;&amp;amp;rp
%mend qlist;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
    <pubDate>Tue, 03 Aug 2021 17:55:07 GMT</pubDate>
    <dc:creator>jimbarbour</dc:creator>
    <dc:date>2021-08-03T17:55:07Z</dc:date>
    <item>
      <title>Add double quoutes between text in macro varible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759033#M239779</link>
      <description>&lt;P&gt;Hello ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to add double quotes between macro varible string based on space deilimeter&amp;nbsp;&lt;/P&gt;&lt;P&gt;this macro varible to use in where conditon in data set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let vars= VAR1 VAR2 VAR3 VAR4;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create another KEEP_VAR macro varible based on above macro varible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%put KEEP_OBS = &amp;amp;KEEP_OBS;&lt;/P&gt;&lt;P&gt;&amp;nbsp; KEEP_OBS= "VAR1" "VAR2' "VAR3" "VAR4" ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So i will use KEEP_OBS in where condiation in data set like below.&lt;/P&gt;&lt;P&gt;data test1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set test2;&lt;/P&gt;&lt;P&gt;where varname in (&amp;amp;KEEP_OBS);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Raja.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 14:23:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759033#M239779</guid>
      <dc:creator>raja777pharma</dc:creator>
      <dc:date>2021-08-03T14:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: Add double quoutes between text in macro varible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759034#M239780</link>
      <description>&lt;P&gt;You can use the %QLIST macro&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/sasutils/macros/blob/master/qlist.sas" target="_blank" rel="noopener"&gt;https://github.com/sasutils/macros/blob/master/qlist.sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where varname in %qlist(&amp;amp;vars);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I point out that your question is quite confusing, you are using &lt;FONT face="courier new,courier"&gt;VAR&lt;/FONT&gt; which seems to indicate you are talking about variables, but then you go ahead and include in your code&amp;nbsp;&lt;FONT face="courier new,courier"&gt;where varname in&amp;nbsp;&lt;/FONT&gt;&amp;nbsp;&lt;FONT face="arial,helvetica,sans-serif"&gt;which will not select variables, it will select observations (if you do it properly).&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 14:33:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759034#M239780</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-03T14:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: Add double quoutes between text in macro varible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759040#M239782</link>
      <description>&lt;P&gt;Another option:&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET	Keep_Obs	=	"%QSYSFUNC(TRANWRD(&amp;amp;Keep_Obs, %STR( ),%STR(" ")))";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This assumes that there is only one space between each term in Keep_Obs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there were more than one space between each term, then one would code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET	Keep_Obs	=	"%QSYSFUNC(TRANWRD(%QSYSFUNC(COMPBL(&amp;amp;Keep_Obs)), %STR( ),%STR(" ")))";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 14:52:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759040#M239782</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-03T14:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Add double quoutes between text in macro varible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759043#M239784</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Paige Miller,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for response,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Yes , i am filetring the observations in a data set based on macro varible values based on space delimeterd.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;is any other way to do without use %qlist macro.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Raja&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 14:56:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759043#M239784</guid>
      <dc:creator>raja777pharma</dc:creator>
      <dc:date>2021-08-03T14:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add double quoutes between text in macro varible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759044#M239785</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/309000"&gt;@raja777pharma&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes , i am filetring the observations in a data set based on macro varible values based on space delimeterd.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;is any other way to do without use %qlist macro.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sure, you could write your own macro, or custom code that works. But why, when %qlist works?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 15:01:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759044#M239785</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-03T15:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Add double quoutes between text in macro varible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759046#M239787</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/309000"&gt;@raja777pharma&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;is any other way to do without use %qlist macro.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't know if you saw my earlier response, but:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET	Keep_Obs	=	"%QSYSFUNC(TRANWRD(%QSYSFUNC(COMPBL(&amp;amp;Keep_Obs)), %STR( ),%STR(" ")))";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 15:02:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759046#M239787</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-03T15:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Add double quoutes between text in macro varible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759091#M239812</link>
      <description>&lt;P&gt;I'm sure this works, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37107"&gt;@jimbarbour&lt;/a&gt;&amp;nbsp;, but to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/309000"&gt;@raja777pharma&lt;/a&gt;: it is just soooooo much easier to type %qlist&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 17:06:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759091#M239812</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-03T17:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: Add double quoutes between text in macro varible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759107#M239819</link>
      <description>&lt;P&gt;I agree, although if one feels the need to understand the code, qlist is perhaps more complicated, and some of the comments don't make sense, at least to me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why is there a comment in front of &amp;amp;rp in this code?&amp;nbsp; I see what &amp;amp;rp is doing, but I don't understand why that comment would be necessary, although I have not played with the code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%*----------------------------------------------------------------------
Add parentheses when requested.
-----------------------------------------------------------------------;
%*;&amp;amp;rp
%mend qlist;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 17:55:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759107#M239819</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-03T17:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Add double quoutes between text in macro varible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759127#M239826</link>
      <description>&lt;P&gt;The FINDW() function is useful.&lt;/P&gt;
&lt;P&gt;You can use the i modifier to make the test case insensitive.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let list=A b c D ;
...
where findw("&amp;amp;list",varname,' ','it')
...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Aug 2021 19:41:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759127#M239826</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-03T19:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Add double quoutes between text in macro varible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759128#M239827</link>
      <description>&lt;P&gt;The macro is over complicated because it supports additional options not needed in this case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume the empty comment is the one you don't understand?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It will prevent SAS from generating an extra space in front of the value of &amp;amp;rp. Without it you get something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;('a','b' )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;instead of&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;('a','b')&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There are other ways to suppress that leading space, but I find that one the easiest to code.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 19:50:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759128#M239827</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-03T19:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Add double quoutes between text in macro varible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759155#M239837</link>
      <description>&lt;P&gt;Ah.&amp;nbsp; Interesting.&amp;nbsp; It looked too deliberate to be a casual error.&amp;nbsp; I figured there had to be some reason for it, but it wasn't immediately obvious.&amp;nbsp; Thank you.&amp;nbsp; That tidbit might actually come in handy some day.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 22:00:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759155#M239837</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-03T22:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Add double quoutes between text in macro varible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759339#M239958</link>
      <description>&lt;PRE&gt;%let vars= VAR1 VAR2 VAR3 VAR4; 

%let want="%sysfunc(prxchange(s/\s+/" "/,-1,&amp;amp;vars))";


%put %bquote(&amp;amp;want);&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Aug 2021 14:21:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-double-quoutes-between-text-in-macro-varible/m-p/759339#M239958</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-08-04T14:21:09Z</dc:date>
    </item>
  </channel>
</rss>

