<?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: First three characters of the variable are between A and Z in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/526948#M143602</link>
    <description>&lt;P&gt;easy,safe and fast with anyalpha&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input string $;
datalines;
abc234
123abc
a2c123
fghfwd
run;

data want;
set have;
_c=0;
do pos=1 to 3;
_c+anyalpha(string,pos);
end;
if _c=6 then put  string = 'check for 1st 3 letters in A-Z is true';/*write to the log*/
drop _c;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 14 Jan 2019 15:02:50 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-01-14T15:02:50Z</dc:date>
    <item>
      <title>First three characters of the variable are between A and Z</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/526929#M143594</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need need help picking up the values where the first 3 characters of the value are between A and Z. I know to do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;substr(myvar,1,3) in ('A',......,'Z')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but don't want to spell out every letter in the alphabet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a workaround this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 13:52:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/526929#M143594</guid>
      <dc:creator>serrld113</dc:creator>
      <dc:date>2019-01-14T13:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: First three characters of the variable are between A and Z</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/526931#M143595</link>
      <description>&lt;P&gt;like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input string $;
datalines;
abc234
123abc
a2c123
fghfwd
run;

data want;
   set have;
   if prxmatch('/[a-z]{3}/', string);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: To ignore cases, add an 'i' like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input string $;
datalines;
Abc234
123abc
a2c123
fghfwd
run;

data want;
   set have;
   if prxmatch('/[a-z]{3}/i', string);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 14:40:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/526931#M143595</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-01-14T14:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: First three characters of the variable are between A and Z</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/526932#M143596</link>
      <description>&lt;P&gt;You could use the NOTALPHA function.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=fedsqlref&amp;amp;docsetTarget=n0xguvefrac656n1cbnaimkb0byj.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=fedsqlref&amp;amp;docsetTarget=n0xguvefrac656n1cbnaimkb0byj.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if notalpha(myvar)&amp;gt;3 or notalpha(myvar)=0 then ... ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 14:13:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/526932#M143596</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-14T14:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: First three characters of the variable are between A and Z</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/526948#M143602</link>
      <description>&lt;P&gt;easy,safe and fast with anyalpha&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input string $;
datalines;
abc234
123abc
a2c123
fghfwd
run;

data want;
set have;
_c=0;
do pos=1 to 3;
_c+anyalpha(string,pos);
end;
if _c=6 then put  string = 'check for 1st 3 letters in A-Z is true';/*write to the log*/
drop _c;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jan 2019 15:02:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/526948#M143602</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-14T15:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: First three characters of the variable are between A and Z</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/526949#M143603</link>
      <description>&lt;P&gt;Do you want to test each of the three characters?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or just that the first letter falls between A and Z?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What about lowercase letters?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 15:08:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/526949#M143603</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-14T15:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: First three characters of the variable are between A and Z</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/526955#M143605</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; You are full of brains. Thank you for that idea&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input string $;
datalines;
AbC234
123abc
a2c123
fghfwd
run;

data want;
set have;
if notalpha(substr(string,1,3))=0 then  put  string = 'check for 1st 3 letters in A-Z is true';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jan 2019 15:23:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/526955#M143605</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-14T15:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: First three characters of the variable are between A and Z</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/527240#M143699</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input string $;
datalines;
abc234
123abc
a2c123
fghfwd
Ads23d
BS2Csd
run;

data want;
   set have;
   if prxmatch('/[^a-z]/i', substr(string,1,3)) then delete;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Jan 2019 09:05:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-three-characters-of-the-variable-are-between-A-and-Z/m-p/527240#M143699</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-01-15T09:05:51Z</dc:date>
    </item>
  </channel>
</rss>

