<?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: Excluding variables of varlist A from variables of varlist B in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Excluding-variables-of-varlist-A-from-variables-of-varlist-B/m-p/242607#M55823</link>
    <description>&lt;P&gt;Thanks so much&lt;/P&gt;</description>
    <pubDate>Sun, 10 Jan 2016 13:16:05 GMT</pubDate>
    <dc:creator>Moh</dc:creator>
    <dc:date>2016-01-10T13:16:05Z</dc:date>
    <item>
      <title>Excluding variables of varlist A from variables of varlist B</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Excluding-variables-of-varlist-A-from-variables-of-varlist-B/m-p/242577#M55815</link>
      <description>&lt;P&gt;Hi folks:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following varlists (_effectentered and _effectremoved).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to have another varlist (_stdvar) which excludes &amp;amp;_effectremoved from &amp;amp;_effectentered.&lt;/P&gt;&lt;P&gt;I tried the following code but the problem is that x2 will be dropped from x23 as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let _EffectEntered = x1 x2 x3 x23 ;&lt;BR /&gt;%let _EffectRemoved = x2 x3 ;&lt;BR /&gt;%let _stdvar=%sysfunc(prxchange(s/%sysfunc(translate(&amp;amp;_EffectRemoved,%str(|),%str( )))//,-1,&amp;amp;_EffectEntered));&lt;BR /&gt;%put &amp;amp;_stdvar ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;would you please help me in this regard?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 21:05:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Excluding-variables-of-varlist-A-from-variables-of-varlist-B/m-p/242577#M55815</guid>
      <dc:creator>Moh</dc:creator>
      <dc:date>2016-01-09T21:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding variables of varlist A from variables of varlist B</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Excluding-variables-of-varlist-A-from-variables-of-varlist-B/m-p/242582#M55816</link>
      <description>&lt;P&gt;Hi Moh,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good idea to use PRXCHANGE here, so you can perform this fairly complex operation within the %LET statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you should insert word boundary metacharacters and put the "or" expression in parentheses to make sure that only complete words are replaced, not substrings of longer words:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let _stdvar=%cmpres(%sysfunc(prxchange(s/\b(%sysfunc(translate(&amp;amp;_EffectRemoved,%str(|),%str( ))))\b//,-1,&amp;amp;_EffectEntered)));
%put &amp;amp;_stdvar;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The %CMPRES&amp;nbsp;function (or macro) replaces multiple blanks by single blanks.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 22:07:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Excluding-variables-of-varlist-A-from-variables-of-varlist-B/m-p/242582#M55816</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-01-09T22:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding variables of varlist A from variables of varlist B</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Excluding-variables-of-varlist-A-from-variables-of-varlist-B/m-p/242593#M55818</link>
      <description>&lt;P&gt;Essentially, this will be the same problem as one that was recently answered:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242534" target="_blank"&gt;https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242534&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming that it is OK to uppercase the variable names:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let _stdvar=;&lt;/P&gt;
&lt;P&gt;%let _EffectEntered = %upcase(&amp;amp;_EffectEntered);&lt;/P&gt;
&lt;P&gt;%let _EffectRemoved = %upcase(&amp;amp;_EffectRemoved);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%do i=1 %to %sysfunc(countw(&amp;amp;_EffectEntered));&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %let nextone = %scan(&amp;amp;_EffectEntered, &amp;amp;i);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %if %index( %str( &amp;amp;_EffectRemoved ), %str( &amp;amp;nextone )) = 0 %then %let _stdvar = &amp;amp;_stdvar &amp;amp;nextone;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The usual warnings apply. &amp;nbsp;You will need to define a macro since the code uses %IF. &amp;nbsp;In that case, you need to pay attention to which macro variables are local and which are global.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jan 2016 04:39:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Excluding-variables-of-varlist-A-from-variables-of-varlist-B/m-p/242593#M55818</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-01-10T04:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding variables of varlist A from variables of varlist B</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Excluding-variables-of-varlist-A-from-variables-of-varlist-B/m-p/242607#M55823</link>
      <description>&lt;P&gt;Thanks so much&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jan 2016 13:16:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Excluding-variables-of-varlist-A-from-variables-of-varlist-B/m-p/242607#M55823</guid>
      <dc:creator>Moh</dc:creator>
      <dc:date>2016-01-10T13:16:05Z</dc:date>
    </item>
  </channel>
</rss>

