<?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: Filter data records using Wildcards in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Filter-data-records-using-Wildcards/m-p/73603#M21343</link>
    <description>&lt;P&gt;Hi:&lt;BR /&gt; SAS has a lot of string processing functions (such as FIND, FINDW, INDEX, INDEXC, etc) and Perl Regular Expressions which might work for you. It also might be that a simple LIKE or CONTAINS operator might work for you.&lt;BR /&gt; &lt;BR /&gt; For example, this PROC PRINT shows the use of a WHERE clause using the LIKE operator. With the LIKE operator, the underscore (_) is a wildcard for one character and the percent sign (%) is a wildcard for more than one character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/68089/HTML/default/viewer.htm#p0eaz2e63dlj17n1i5z17z3h84vp.htm" target="_self"&gt;"Syntax of WHERE Expression"&lt;/A&gt; in the SAS documentation.&lt;BR /&gt;&lt;BR /&gt; cynthia&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data words;
    infile datalines;
    input vqueue $;
    return;
    datalines;
CTXYZ
XYZ.CT
ABCTG
RS.CT
;
run;

proc print data=words;
    where VQueue like '%.CT';
    title 'Search for %.CT - where % represents any characters before .CT';
run;

proc print data=words;
    title 'Search for __XYZ -- 2 underscores represent any 2 characters before XYZ';
    where VQueue like '__XYZ';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Aug 2016 14:13:17 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2016-08-19T14:13:17Z</dc:date>
    <item>
      <title>Filter data records using Wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filter-data-records-using-Wildcards/m-p/73602#M21342</link>
      <description>&lt;P&gt;Hello&lt;BR /&gt; &lt;BR /&gt; I am attempting to query all records from a table where VQueue ends with .CT&lt;BR /&gt; Help please.&lt;BR /&gt; &lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table Queue as
select * 
  from hierarchy
   WHERE VQueue = '*.CT';
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Aug 2016 14:09:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filter-data-records-using-Wildcards/m-p/73602#M21342</guid>
      <dc:creator>fredbell</dc:creator>
      <dc:date>2016-08-19T14:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Filter data records using Wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filter-data-records-using-Wildcards/m-p/73603#M21343</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt; SAS has a lot of string processing functions (such as FIND, FINDW, INDEX, INDEXC, etc) and Perl Regular Expressions which might work for you. It also might be that a simple LIKE or CONTAINS operator might work for you.&lt;BR /&gt; &lt;BR /&gt; For example, this PROC PRINT shows the use of a WHERE clause using the LIKE operator. With the LIKE operator, the underscore (_) is a wildcard for one character and the percent sign (%) is a wildcard for more than one character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/68089/HTML/default/viewer.htm#p0eaz2e63dlj17n1i5z17z3h84vp.htm" target="_self"&gt;"Syntax of WHERE Expression"&lt;/A&gt; in the SAS documentation.&lt;BR /&gt;&lt;BR /&gt; cynthia&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data words;
    infile datalines;
    input vqueue $;
    return;
    datalines;
CTXYZ
XYZ.CT
ABCTG
RS.CT
;
run;

proc print data=words;
    where VQueue like '%.CT';
    title 'Search for %.CT - where % represents any characters before .CT';
run;

proc print data=words;
    title 'Search for __XYZ -- 2 underscores represent any 2 characters before XYZ';
    where VQueue like '__XYZ';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 14:13:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filter-data-records-using-Wildcards/m-p/73603#M21343</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-08-19T14:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filter-data-records-using-Wildcards/m-p/73604#M21344</link>
      <description>Thank you, i went with the Contains and it worked out.&lt;BR /&gt;
&lt;BR /&gt;
Fred</description>
      <pubDate>Tue, 21 Sep 2010 17:00:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filter-data-records-using-Wildcards/m-p/73604#M21344</guid>
      <dc:creator>fredbell</dc:creator>
      <dc:date>2010-09-21T17:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filter-data-records-using-Wildcards/m-p/73605#M21345</link>
      <description>Fred,&lt;BR /&gt;
&lt;BR /&gt;
Since you had indicated that you wanted strings that "ended with "CT", I would have gone with Cynthia's suggestion to use the LIKE operator.&lt;BR /&gt;
&lt;BR /&gt;
Art</description>
      <pubDate>Tue, 21 Sep 2010 17:26:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filter-data-records-using-Wildcards/m-p/73605#M21345</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2010-09-21T17:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filter-data-records-using-Wildcards/m-p/73606#M21346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can we use Wild Characters in Data Step?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to get something like.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Apple;&lt;/P&gt;&lt;P&gt;Set Ball;&lt;/P&gt;&lt;P&gt;where &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;upcase(trim(Column2)) like '%CAR%'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i got an error for this.&lt;/P&gt;&lt;P&gt;Is there any way to use this in Datastep?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2014 22:14:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filter-data-records-using-Wildcards/m-p/73606#M21346</guid>
      <dc:creator>RohitV</dc:creator>
      <dc:date>2014-10-28T22:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filter-data-records-using-Wildcards/m-p/73607#M21347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data Apple;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Set Ball;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if find(&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;upcase(trim(Column2)) , 'CAR' ) &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Oct 2014 11:29:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filter-data-records-using-Wildcards/m-p/73607#M21347</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-10-29T11:29:02Z</dc:date>
    </item>
  </channel>
</rss>

