<?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: Proc sql 'select' varialbes containing &amp;quot;somecharacters&amp;quot; in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-select-variables-containing-quot-somecharacters-quot/m-p/479770#M71499</link>
    <description>&lt;P&gt;First us the metadata in dictionary.columns to identify the variables of interest, and save them as a space-separated list in a macrovar named VARLIST:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  select distinct name into :varlist separated by ' '
  from dictionary.columns 
    where libname='WORK'and memname='HAVE'
	and name like "_RR";
quit;
%put &amp;amp;=varlist;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then use that macrovar for your objective:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have (keep=&amp;amp;varlist);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 20 Jul 2018 01:28:57 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2018-07-20T01:28:57Z</dc:date>
    <item>
      <title>Proc sql 'select' variables containing "somecharacters"</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-select-variables-containing-quot-somecharacters-quot/m-p/479767#M71498</link>
      <description>&lt;P&gt;SAS 9.3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to subset data where you select variables to include that have a certain number of letters occurring in them in a particular order?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance, I want to select, out of a long list of variables the ones ending in 'RR'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.TEST" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;s1_dg_tif_FAD&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;s1_dg_tif_NAD&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;s1_dg_tif_RR&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 20 Jul 2018 01:25:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-select-variables-containing-quot-somecharacters-quot/m-p/479767#M71498</guid>
      <dc:creator>Gjax21</dc:creator>
      <dc:date>2018-07-20T01:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql 'select' varialbes containing "somecharacters"</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-select-variables-containing-quot-somecharacters-quot/m-p/479770#M71499</link>
      <description>&lt;P&gt;First us the metadata in dictionary.columns to identify the variables of interest, and save them as a space-separated list in a macrovar named VARLIST:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  select distinct name into :varlist separated by ' '
  from dictionary.columns 
    where libname='WORK'and memname='HAVE'
	and name like "_RR";
quit;
%put &amp;amp;=varlist;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then use that macrovar for your objective:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have (keep=&amp;amp;varlist);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Jul 2018 01:28:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-select-variables-containing-quot-somecharacters-quot/m-p/479770#M71499</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-07-20T01:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql 'select' varialbes containing "somecharacters"</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-select-variables-containing-quot-somecharacters-quot/m-p/479771#M71500</link>
      <description>&lt;P&gt;Will give it a shot thanks&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 01:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-select-variables-containing-quot-somecharacters-quot/m-p/479771#M71500</guid>
      <dc:creator>Gjax21</dc:creator>
      <dc:date>2018-07-20T01:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql 'select' varialbes containing "somecharacters"</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-select-variables-containing-quot-somecharacters-quot/m-p/479805#M71501</link>
      <description>&lt;P&gt;to match names ending in "_RR", use the condition&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;trim(name) like "%^_RR" escape "^"&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or the condition&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;prxmatch("/_RR$/i", trim(name))&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 05:49:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-select-variables-containing-quot-somecharacters-quot/m-p/479805#M71501</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-07-20T05:49:16Z</dc:date>
    </item>
  </channel>
</rss>

