<?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: Keep if start with letter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337376#M76601</link>
    <description>&lt;P&gt;Use the length() function to determine the current string length.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Mar 2017 14:38:41 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-03-02T14:38:41Z</dc:date>
    <item>
      <title>Keep if start with letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337360#M76597</link>
      <description>&lt;P&gt;How can i remove the data if the variable is not start with a letter. Should i type all the letter or any other short way&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;A153&lt;/P&gt;
&lt;P&gt;B124&lt;/P&gt;
&lt;P&gt;0564&lt;/P&gt;
&lt;P&gt;.1548&lt;/P&gt;
&lt;P&gt;na&lt;/P&gt;
&lt;P&gt;w853&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to keep only these variables. It should be 4 character long&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;variable&lt;/P&gt;
&lt;P&gt;A153&lt;/P&gt;
&lt;P&gt;B124&lt;/P&gt;
&lt;P&gt;w853&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 14:29:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337360#M76597</guid>
      <dc:creator>user24</dc:creator>
      <dc:date>2017-03-02T14:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: Keep if start with letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337370#M76599</link>
      <description>&lt;P&gt;What about 'na'? That starts with a letter two?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, something 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 variable $;
datalines;
 A153
B124
0564
.1548
na
w853
;

data want;
   set have;
   where substr(variable,1,1) not in ('0','1','2','3','4','5','6','7','8','9','.',' ');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Mar 2017 14:31:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337370#M76599</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-03-02T14:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Keep if start with letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337373#M76600</link>
      <description>how can i remove if the character long not more than 4 or less than 4</description>
      <pubDate>Thu, 02 Mar 2017 14:35:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337373#M76600</guid>
      <dc:creator>user24</dc:creator>
      <dc:date>2017-03-02T14:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Keep if start with letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337376#M76601</link>
      <description>&lt;P&gt;Use the length() function to determine the current string length.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 14:38:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337376#M76601</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-02T14:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Keep if start with letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337378#M76602</link>
      <description>&lt;P&gt;Pretty sure your just pulling our leg now, we ask for test data in the form of a datastep every post. &amp;nbsp;As such this is just logic snippets:&lt;/P&gt;
&lt;PRE&gt;data want;
  string="A153";
  isfirstalpha=ifn(lengthn(compress(char(string,1)," ","a")),0,1);
  islength=lengthn(string);
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Mar 2017 14:39:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337378#M76602</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-03-02T14:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: Keep if start with letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337381#M76603</link>
      <description>&lt;P&gt;A short way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if length(variable)=4 and anyalpha(variable)=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By using ANYALPHA, you don't have to guess what characters might arrive in the next batch of data.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 14:47:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337381#M76603</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-02T14:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Keep if start with letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337385#M76605</link>
      <description>&lt;P&gt;Just to note its only the first character, so:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if length(variable)=4 and anyalpha(char(variable,1))=1;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good point about anyalpha() function, saves compress.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 14:50:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337385#M76605</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-03-02T14:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Keep if start with letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337395#M76609</link>
      <description>&lt;P&gt;No, the complications aren't needed. I stand by my original post.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ANYALPHA returns the position of the first alpha character.&amp;nbsp; So by checking that ANYALPHA returns a 1, that's enough.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 15:05:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337395#M76609</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-02T15:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: Keep if start with letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337702#M76738</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input variable $;
datalines;
 A153
B124
0564
.1548
na
w853
;
data want;
 set have;
 if prxmatch('/^[a-z]\S{3}$/i',strip(variable));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Mar 2017 10:33:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337702#M76738</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-03-03T10:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Keep if start with letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337709#M76742</link>
      <description>&lt;P&gt;I think&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;meant the following (to ensure that strings were only 4 characters long):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
input variable $;
datalines;
 A153
B124xxx
d5555
0564
.1548
na
AAAA
w853
;
data want;
 set have;
 if prxmatch('/^[a-z][a-z0-9]{3}$/i',strip(variable));
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 04:54:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337709#M76742</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-03T04:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Keep if start with letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337766#M76770</link>
      <description>Yeah.I forgot  $ .</description>
      <pubDate>Fri, 03 Mar 2017 10:15:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-if-start-with-letter/m-p/337766#M76770</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-03-03T10:15:42Z</dc:date>
    </item>
  </channel>
</rss>

