<?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: How to extract first letters and numbers from a character variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-extract-first-letters-and-numbers-from-a-character/m-p/199297#M49821</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your answers&lt;/P&gt;&lt;P&gt;ballardw: no, I don't have IDs starting with only one letter or one numeral&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The IDs starting with SP indicate a type of affiliation (thanks Mark! I can identified these people now creating the new_var), those with two digits and then the hyphen have a different affiliation as those starting with numbers but with hyphen at the end like -01, -02 etc, but I still need to separate these latter two groups &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Jun 2015 16:51:08 GMT</pubDate>
    <dc:creator>lalohg</dc:creator>
    <dc:date>2015-06-25T16:51:08Z</dc:date>
    <item>
      <title>How to extract first letters and numbers from a character variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-extract-first-letters-and-numbers-from-a-character/m-p/199294#M49818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I have a character variable with letters numbers and hyphen sign and would like to extract the letters and the first two digits before the FIRST hyphen sign and create a new variable identifying these people, here is an example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variable ID looks like:&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 182px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7;" width="182"&gt;0165218-09&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7; background: #dce6f1;"&gt;0165218-09&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7;"&gt;0165218-09&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7; background: #dce6f1;"&gt;13-06-0290&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7;"&gt;SP131536-01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7; background: #dce6f1;"&gt;SP131536-01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7;"&gt;0142135-02&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7; background: #dce6f1;"&gt;0142135-02&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7;"&gt;0142135-02&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The new variable will look like&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 182px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7;" width="182"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7; background: #dce6f1;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7; background: #dce6f1;"&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7;"&gt;SP&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7; background: #dce6f1;"&gt;SP&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7; background: #dce6f1;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="font-size: 11pt; color: black; font-family: Calibri; border-top-width: 0.5pt; border-style: solid none; border-top-color: #95b3d7; border-bottom-width: 0.5pt; border-bottom-color: #95b3d7;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;all your help will be appreciated&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jun 2015 18:58:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-extract-first-letters-and-numbers-from-a-character/m-p/199294#M49818</guid>
      <dc:creator>lalohg</dc:creator>
      <dc:date>2015-06-03T18:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract first letters and numbers from a character variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-extract-first-letters-and-numbers-from-a-character/m-p/199295#M49819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have any that start with one letter: S12345-67? Or one numeral then the hyphen: 1-234-456? If so how are these processed?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jun 2015 19:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-extract-first-letters-and-numbers-from-a-character/m-p/199295#M49819</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-06-03T19:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract first letters and numbers from a character variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-extract-first-letters-and-numbers-from-a-character/m-p/199296#M49820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first two characters will be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;new_var = substr(variable,1,2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure what you are getting at with the hyphen.&amp;nbsp; If the hyphen is important for another reason you might have to use something in addition to this like scan().&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jun 2015 19:14:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-extract-first-letters-and-numbers-from-a-character/m-p/199296#M49820</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-06-03T19:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract first letters and numbers from a character variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-extract-first-letters-and-numbers-from-a-character/m-p/199297#M49821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your answers&lt;/P&gt;&lt;P&gt;ballardw: no, I don't have IDs starting with only one letter or one numeral&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The IDs starting with SP indicate a type of affiliation (thanks Mark! I can identified these people now creating the new_var), those with two digits and then the hyphen have a different affiliation as those starting with numbers but with hyphen at the end like -01, -02 etc, but I still need to separate these latter two groups &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2015 16:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-extract-first-letters-and-numbers-from-a-character/m-p/199297#M49821</guid>
      <dc:creator>lalohg</dc:creator>
      <dc:date>2015-06-25T16:51:08Z</dc:date>
    </item>
  </channel>
</rss>

