<?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 length issue in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33743#M8167</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Couldn't you just state it the way you did in your post?&amp;nbsp; i.e.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set id;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if length(id) lt 7 then delete;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Oct 2011 20:38:26 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2011-10-24T20:38:26Z</dc:date>
    <item>
      <title>length issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33742#M8166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a field Id, if the id is length of provno less than 7 then delete..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data id;&lt;/P&gt;&lt;P&gt;set id;&lt;/P&gt;&lt;P&gt;cards;1&lt;/P&gt;&lt;P&gt;234-A35&lt;/P&gt;&lt;P&gt;1234567-d45&lt;/P&gt;&lt;P&gt;e453768&lt;/P&gt;&lt;P&gt;*123456789&lt;/P&gt;&lt;P&gt;*12345&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 20:33:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33742#M8166</guid>
      <dc:creator>raveena</dc:creator>
      <dc:date>2011-10-24T20:33:10Z</dc:date>
    </item>
    <item>
      <title>length issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33743#M8167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Couldn't you just state it the way you did in your post?&amp;nbsp; i.e.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set id;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if length(id) lt 7 then delete;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 20:38:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33743#M8167</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-10-24T20:38:26Z</dc:date>
    </item>
    <item>
      <title>length issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33744#M8168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thanks Art..I need to clarify one more thing,If &lt;/P&gt;&lt;P&gt; DOES NOT BEGIN WITH A – Z OR 0 -9 OR THE LENGTH OF ID= 1 then delete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 20:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33744#M8168</guid>
      <dc:creator>raveena</dc:creator>
      <dc:date>2011-10-24T20:58:01Z</dc:date>
    </item>
    <item>
      <title>length issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33745#M8169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A couple of questions:&lt;/P&gt;&lt;P&gt;A-Z or a-z?&lt;/P&gt;&lt;P&gt;1 is less than 7 or have you now changed the requirement of length to just be -1?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 21:08:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33745#M8169</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-10-24T21:08:19Z</dc:date>
    </item>
    <item>
      <title>length issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33746#M8170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi Art,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO NOT SELECT A ID WHEN THE ID IS EMPTY OR DOES NOT BEGIN WITH A – Z OR 0 -9 OR THE LENGTH OF ID= 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This one for other requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help !!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 21:15:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33746#M8170</guid>
      <dc:creator>raveena</dc:creator>
      <dc:date>2011-10-24T21:15:23Z</dc:date>
    </item>
    <item>
      <title>length issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33747#M8171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the following does what you want:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data id;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards truncover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat id $10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input id;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1234-A35&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1234567-d45&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;e453768&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;A123&lt;/P&gt;&lt;P&gt;*123456789&lt;/P&gt;&lt;P&gt;*12345&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set id;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if not (('A'&amp;lt;=substr(id,1,1)&amp;lt;='Z') or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ('0'&amp;lt;=substr(id,1,1)&amp;lt;='9'))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; or length(id) le 1 then delete;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 21:30:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33747#M8171</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-10-24T21:30:05Z</dc:date>
    </item>
    <item>
      <title>length issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33748#M8172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is solution with regex...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data foo;&lt;/P&gt;&lt;P&gt; infile cards truncover;&lt;/P&gt;&lt;P&gt; input @1 id $10.;&lt;/P&gt;&lt;P&gt; cards;&lt;/P&gt;&lt;P&gt;1234-A35&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1234567-d45&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e453768&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;A123&lt;/P&gt;&lt;P&gt;*123456789&lt;/P&gt;&lt;P&gt;*12345&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data bar;&lt;/P&gt;&lt;P&gt; set foo;&lt;/P&gt;&lt;P&gt; if prxmatch('/^[A-Z0-9]\S.+$/',id)&amp;gt;0;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will output&lt;/P&gt;&lt;P&gt;1234-A35&lt;/P&gt;&lt;P&gt;1234567-d4&lt;/P&gt;&lt;P&gt;A123&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To add additional case of e453768 change expression to '/^[A-Z0-9]\S.+$/i'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 23:08:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33748#M8172</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-10-24T23:08:34Z</dc:date>
    </item>
    <item>
      <title>length issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33749#M8173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data id;
&amp;nbsp; infile cards truncover;
&amp;nbsp; informat id $10.;
&amp;nbsp; input id;
cards;
1234-A35
 
1234567-d45
&amp;nbsp;&amp;nbsp; 
e453768
1
A123
*123456789
*12345
;
run;

 

data want;
&amp;nbsp; set id;
if lengthn(id) in (0 1) or anyalnum(id) ne 1&amp;nbsp; then delete;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Oct 2011 02:04:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33749#M8173</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-10-25T02:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: length issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33750#M8174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ... neat. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not knowing much about PRX, I do understand the checking of the first character using&lt;/P&gt;&lt;P&gt;[A-Z0-9] but I don't understand how the string checks the length (criteria &amp;gt; 1).&amp;nbsp; This ID (with an embedded space&lt;/P&gt;&lt;P&gt;as the 2nd character) seems to be an acceptable ID based on the rules (start with A-Z, 0-9 and length &amp;gt; 1) but is not &lt;/P&gt;&lt;P&gt;picked up by the PRXMATCH string.&amp;nbsp; I guess that would happen with any acceptable 1st character followed by&lt;/P&gt;&lt;P&gt;one or more spaces plus more characters.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any way to modify to be a better check of variable length &amp;gt; 1 (could be useful)?&amp;nbsp; Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data foo;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;infile cards truncover;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;input @1 id $10.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;cards;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;A 123&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data bar;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;set foo;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;if prxmatch('/^[A-Z0-9]\S.+$/',id)&amp;gt;0;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Oct 2011 14:19:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33750#M8174</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2011-10-25T14:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: length issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33751#M8175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I will explain the expression '/^[A-Z0-9]\S.+$/'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;^[A-Z0-9] the start of the string is a letter A-Z or digit 0-9&lt;/P&gt;&lt;P&gt;\S the second character in the string is not a white space type&lt;/P&gt;&lt;P&gt;.+$ any character 1 or more times till end of string&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;because we are not striping the padding from the inbound variable this will match any string of more than 1 character even though it seems to imply an excepted length or three or more and not 2 or more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to accept these cases with embeded spaces I would modify the expression to the following.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;prxmatch('/^[A-Z0-9].{1,}$/',strip(id))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;^[A-Z0-9] the start of the string is letter A-Z or digit 0-9&lt;/P&gt;&lt;P&gt;.{1,}$ followed by any character (except new line) 1 or more times&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;without the strip function on the inbound variable id the strings will be padded and match for length even though they may not be more that 1 character long.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data foo(where=(prxmatch('/^[A-Z0-9].{1,}$/',strip(id))));&lt;/P&gt;&lt;P&gt; infile cards truncover;&lt;/P&gt;&lt;P&gt; input @1 id $10.;&lt;/P&gt;&lt;P&gt; cards;&lt;/P&gt;&lt;P&gt;1234-A35&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1234567-d45&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e453768&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;A123&lt;/P&gt;&lt;P&gt;A 123&lt;/P&gt;&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123&lt;/P&gt;&lt;P&gt;*123456789&lt;/P&gt;&lt;P&gt;*12345&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1234-A35&lt;/P&gt;&lt;P&gt;1234567-d4&lt;/P&gt;&lt;P&gt;A123&lt;/P&gt;&lt;P&gt;A 123&lt;/P&gt;&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like previous to make the expression not case sensitive '/^[A-Z0-9].{1,}$/i' will capture the additional id e453768.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This expression is also the same as /^[A-Z0-9].+$/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ means repeat previous statement 1 or more times&lt;/P&gt;&lt;P&gt;{n} means repeat exactly n times&lt;/P&gt;&lt;P&gt;{n,m} means repeat n to m times&lt;/P&gt;&lt;P&gt;{n,} means repeat n or more times&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so + and {1,} are the same...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Oct 2011 15:43:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/length-issue/m-p/33751#M8175</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-10-25T15:43:37Z</dc:date>
    </item>
  </channel>
</rss>

