<?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 how to delete a substring in a character string in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211514#M52235</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using SAS to format an excel file. Some of the rows in a particular field, Vendor, contain a VND number.&amp;nbsp; These entries show up as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PIZZA HUT(VND+1234567890)&lt;/P&gt;&lt;P&gt;BILL SMITH(VND+9876543210)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not all rows have a VND number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the rows that do, I would like to delete the (VND+XXXXXXXXXX)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried using Vendor=tranwrd(Vendor, '(VND+',' '); but can't seem to figure out how to add a wildcard after the +.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions what be greatly appreciated.&amp;nbsp; Perhaps tranwrd is not the best way to go about this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 May 2015 17:59:21 GMT</pubDate>
    <dc:creator>jmckenzie</dc:creator>
    <dc:date>2015-05-07T17:59:21Z</dc:date>
    <item>
      <title>how to delete a substring in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211514#M52235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using SAS to format an excel file. Some of the rows in a particular field, Vendor, contain a VND number.&amp;nbsp; These entries show up as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PIZZA HUT(VND+1234567890)&lt;/P&gt;&lt;P&gt;BILL SMITH(VND+9876543210)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not all rows have a VND number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the rows that do, I would like to delete the (VND+XXXXXXXXXX)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried using Vendor=tranwrd(Vendor, '(VND+',' '); but can't seem to figure out how to add a wildcard after the +.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions what be greatly appreciated.&amp;nbsp; Perhaps tranwrd is not the best way to go about this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 17:59:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211514#M52235</guid>
      <dc:creator>jmckenzie</dc:creator>
      <dc:date>2015-05-07T17:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete a substring in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211515#M52236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is close, I can't seem to figure out how to use VND+ as a string rather than 4 different delimiters, I'm hoping someone can shed some light on this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile cards dsd;&lt;/P&gt;&lt;P&gt;length name $50.;&lt;/P&gt;&lt;P&gt;format name $char50.;&lt;/P&gt;&lt;P&gt;input name;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;PIZZA HUT(VND+1234567890)&lt;/P&gt;&lt;P&gt;BILL SMITH(VND+9876543210)&lt;/P&gt;&lt;P&gt;Extra Name(123456789)&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run&lt;/P&gt;&lt;P&gt;data want(drop=name1 name2 name3);&lt;/P&gt;&lt;P&gt;set have(rename=(name=name1));&lt;/P&gt;&lt;P&gt;name2=scan(name1,1,'VND+');&lt;/P&gt;&lt;P&gt;name3=scan(name1,2,'VND+');&lt;/P&gt;&lt;P&gt;name=cats(name2,name3);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 18:24:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211515#M52236</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-05-07T18:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete a substring in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211516#M52237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you do find "VND+", is there ever going to be any text after the closing parenthesis that you would want to keep?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 18:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211516#M52237</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-05-07T18:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete a substring in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211517#M52238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no, the (VND+XXXXXXXXXX) is always the at the end&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 18:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211517#M52238</guid>
      <dc:creator>jmckenzie</dc:creator>
      <dc:date>2015-05-07T18:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete a substring in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211518#M52239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 25.134838104248px; background-color: #ffffff;"&gt;"I can't seem to figure out how to use VND+ as a string rather than 4 different delimiters, "&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 25.134838104248px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 25.134838104248px; background-color: #ffffff;"&gt;Try FIND ()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 25.134838104248px; background-color: #ffffff;"&gt;something like&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 33.5988998413086px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;partname = substr( name, 1, find( name!!"VND+", "VND+" )-1) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 33.5988998413086px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 19:45:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211518#M52239</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2015-05-07T19:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete a substring in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211519#M52240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about this if the VND is always on the end:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if index(vendor, '(VND') then vendor = substr(vendor, index(vendor, '(VND')); &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 19:50:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211519#M52240</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-05-07T19:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete a substring in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211520#M52241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A number of very similar solutions.&amp;nbsp; Here's my variation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vnd_found = index(vendor, '(VND+');&lt;/P&gt;&lt;P&gt;if vnd_found &amp;gt; 1 then vendor = substr(vendor, 1, vnd_found-1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I might be a little extra cautious here, but I imagined the possibility that vendor name was missing and that "(VND+XXXX)" began in column 1.&amp;nbsp; In that case, I would be keeping what is already there so you would have a chance to go back and find the vendor name based on the VND string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 20:21:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211520#M52241</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-05-07T20:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete a substring in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211521#M52242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes, that worked!&amp;nbsp; thank you so much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 20:38:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211521#M52242</guid>
      <dc:creator>jmckenzie</dc:creator>
      <dc:date>2015-05-07T20:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete a substring in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211522#M52243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This could be easy to do by SCAN().&lt;/P&gt;&lt;P&gt;x=scan(vendor,1,'()','&lt;STRONG&gt;m&lt;/STRONG&gt;');&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2015 15:03:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-a-substring-in-a-character-string/m-p/211522#M52243</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-05-08T15:03:05Z</dc:date>
    </item>
  </channel>
</rss>

