<?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 serach for specific text within a string and create a new variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430641#M106449</link>
    <description>&lt;P&gt;YES!!!!! Thank you! This Worked!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are all the best!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jan 2018 20:00:05 GMT</pubDate>
    <dc:creator>sas_student1</dc:creator>
    <dc:date>2018-01-24T20:00:05Z</dc:date>
    <item>
      <title>how to serach for specific text within a string and create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430242#M106351</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was given a dataset with about 6000 rows, unfortunately it was given to me in a text and was not formatted properly. I cannot use the @ or format options to create separate variables/columns for the one long string that was shared.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need to do is to search for a specific set of characters for each row of the database and create a new variable that populates with the search.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this dataset all the elements are in one column. The values in each row are in order.&lt;/P&gt;&lt;P&gt;That is, each row will start with 4 numbers a space and then&amp;nbsp;8 numbers. After that I know that there well be a provider type and there are a certain set of provider types that are listed only, here we see "Auto Enroll Provider", "original Provider", "Collapsed Provider" and "Genesis Provider" there are a few more but not listed in the example below.&lt;/P&gt;&lt;P&gt;After the provider type the name of the provider is listed, I am not sure the length of the name it can be 20 characters, 35 characters or even longer.&lt;/P&gt;&lt;P&gt;Then follows a three digit number&lt;/P&gt;&lt;P&gt;After the number there is always a 02-02 followed by a date that is in a mmddyy10 format (although note that since all this is in one column the date is not formatted)&lt;/P&gt;&lt;P&gt;Following the date will be a four digit number with a "-" and then a small description, not sure the length of the description.&lt;/P&gt;&lt;P&gt;Finally there is a string of characters that always starts with "1-RT BE"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what the sample looks like:&lt;/P&gt;&lt;P&gt;4278 01234567&amp;nbsp; Auto Enroll Provider FAMILY HEACARE 008 02-02 01/01/2018 131.23 0287-HSP OUT SR&amp;nbsp; 1-RT&amp;nbsp;BE 009-COSNF&lt;/P&gt;&lt;P&gt;4273 34876539&amp;nbsp; Original Provider BURKE CENTER 003 02-02 01/01/2018 187.01 0287-HSP OUT SR&amp;nbsp;&amp;nbsp; 1-RT BE 010-COSNA&lt;/P&gt;&lt;P&gt;1468 04876298&amp;nbsp; Collapsed Provider PHOENIX RISES OF&amp;nbsp;NJ INC 005 02-02 01/01/2018 17.67 0160-D&amp;amp;TCS&amp;nbsp; 1-RT BE 009-COSNF &amp;nbsp;&lt;/P&gt;&lt;P&gt;1540 10983746&amp;nbsp; Genesis Provider COLLEGE PARK 016 02-02 01/01/2018 148.43 0160-D&amp;amp;TCS&amp;nbsp; 1-RT BE 013-INVRATECD&lt;/P&gt;&lt;P&gt;1671 34098734&amp;nbsp; Auto Enroll Provider THIS CNTY DOH&amp;nbsp; 004 02-02 01/01/2018 138.70 0287-HSP OUT SR&amp;nbsp; 1-RT BE 040-INVREQ&amp;nbsp;&lt;/P&gt;&lt;P&gt;1671 45398726&amp;nbsp; Auto Enroll Provider THAT CLINIC&amp;nbsp; 004 02-02 01/01/2018 138.70 0287-HSP OUT SR&amp;nbsp; 1-RT BE 009-COSNF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this is what I am trying to get to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Rate&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Provider&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;NAME&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;ProvID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;type&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;amount&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Desc&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;RT&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4278&lt;/TD&gt;&lt;TD&gt;01234567&lt;/TD&gt;&lt;TD&gt;Auto Enroll Provider&lt;/TD&gt;&lt;TD&gt;FAMILY HEALTHCARE&lt;/TD&gt;&lt;TD&gt;008&lt;/TD&gt;&lt;TD&gt;02-02&lt;/TD&gt;&lt;TD&gt;1/1/2018&lt;/TD&gt;&lt;TD&gt;131.23&lt;/TD&gt;&lt;TD&gt;0287-HSP OUT SR&lt;/TD&gt;&lt;TD&gt;1-RT BE 009-COSNF&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4273&lt;/TD&gt;&lt;TD&gt;34876539&lt;/TD&gt;&lt;TD&gt;Original Provider&lt;/TD&gt;&lt;TD&gt;BURKE HEALTH CENTER&lt;/TD&gt;&lt;TD&gt;003&lt;/TD&gt;&lt;TD&gt;02-02&lt;/TD&gt;&lt;TD&gt;1/1/2018&lt;/TD&gt;&lt;TD&gt;187.01&lt;/TD&gt;&lt;TD&gt;0287-HSP OUT SR&lt;/TD&gt;&lt;TD&gt;1-RT BE 010-COSNA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1468&lt;/TD&gt;&lt;TD&gt;04876298&lt;/TD&gt;&lt;TD&gt;Collapsed Provider&lt;/TD&gt;&lt;TD&gt;PHOENIX RISES OF NEW JESRSEY INC&lt;/TD&gt;&lt;TD&gt;005&lt;/TD&gt;&lt;TD&gt;02-02&lt;/TD&gt;&lt;TD&gt;1/1/2018&lt;/TD&gt;&lt;TD&gt;17.67&lt;/TD&gt;&lt;TD&gt;0160-D&amp;amp;TCS&lt;/TD&gt;&lt;TD&gt;1-RT BE 009-COSNF&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1540&lt;/TD&gt;&lt;TD&gt;10983746&lt;/TD&gt;&lt;TD&gt;Genesis Provider&lt;/TD&gt;&lt;TD&gt;COLLEGE PARK&lt;/TD&gt;&lt;TD&gt;016&lt;/TD&gt;&lt;TD&gt;02-02&lt;/TD&gt;&lt;TD&gt;1/1/2018&lt;/TD&gt;&lt;TD&gt;148.43&lt;/TD&gt;&lt;TD&gt;0160-D&amp;amp;TCS&lt;/TD&gt;&lt;TD&gt;1-RT BE 013-INVRATECD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1671&lt;/TD&gt;&lt;TD&gt;34098734&lt;/TD&gt;&lt;TD&gt;Auto Enroll Provider&lt;/TD&gt;&lt;TD&gt;THIS CNTY DOH&lt;/TD&gt;&lt;TD&gt;004&lt;/TD&gt;&lt;TD&gt;02-02&lt;/TD&gt;&lt;TD&gt;1/1/2018&lt;/TD&gt;&lt;TD&gt;138.7&lt;/TD&gt;&lt;TD&gt;0287-HSP OUT SR&lt;/TD&gt;&lt;TD&gt;1-RETR TO BE 040-INVREQ&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1671&lt;/TD&gt;&lt;TD&gt;45398726&lt;/TD&gt;&lt;TD&gt;Auto Enroll Provider&lt;/TD&gt;&lt;TD&gt;THAT CLINIC&lt;/TD&gt;&lt;TD&gt;004&lt;/TD&gt;&lt;TD&gt;02-02&lt;/TD&gt;&lt;TD&gt;1/1/2018&lt;/TD&gt;&lt;TD&gt;138.7&lt;/TD&gt;&lt;TD&gt;0287-HSP OUT SR&lt;/TD&gt;&lt;TD&gt;1-RT BE 009-COSNF&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions would be great!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 05:59:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430242#M106351</guid>
      <dc:creator>sas_student1</dc:creator>
      <dc:date>2018-01-24T05:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to serach for specific text within a string and create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430250#M106352</link>
      <description>&lt;P&gt;Possibly, but you’re going to need to provide better and more sample,data, ideally enough to illustrate several variations of what you’re likely to encounter. Otherwise you’ll get code for a single case that won’t work on your actual data, but technically answers your question.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/103523"&gt;@sas_student1&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;@I was given a dataset with about 6000 rows, unfortunately it was given to me in a text and was not formatted properly. I cannot use the @ or format options to create separate variables/columns for the one long string that was shared.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I need to do is to search for a specific set of characters for each row of the database and create a new variable that populates with the serach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, If I have a database with one coloumn that has something like this:&lt;/P&gt;
&lt;P&gt;1111 23456789 Hospital-name-that-can-be-any-length 003 1/1/13 dollar-amount-that-can-be-any-length&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to create a table from the above that would have 6 coloumns that would contain the following:&lt;/P&gt;
&lt;P&gt;rate : 1111&lt;/P&gt;
&lt;P&gt;ID: 23456789&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hospname: Hospital-name-that-can-be-any-length&lt;/P&gt;
&lt;P&gt;hospID: 003&lt;/P&gt;
&lt;P&gt;Date: 1/1/13&lt;/P&gt;
&lt;P&gt;dollar: dollar-amount-that-can-be-any-length&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think that we can use the PRX function but am not too familiar.&lt;/P&gt;
&lt;P&gt;Any suggestions would be great!&lt;/P&gt;
&lt;P&gt;Hope the example above makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 02:04:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430250#M106352</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-24T02:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to serach for specific text within a string and create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430269#M106357</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a better example:&lt;/P&gt;&lt;P&gt;All the elements are in one column. The values in each row are in order.&lt;/P&gt;&lt;P&gt;That is, each row will start with 4 numbers a space and then&amp;nbsp;8 numbers. After that I know that there well be a provider type and there are a certain set of provider types that are listed only, here we see "Auto Enroll Provider", "original Provider", "Collapsed Provider" and "Genesis Provider" there are a few more but not listed in the example below.&lt;/P&gt;&lt;P&gt;After the provider type the name of the provider is listed, I am not sure the length of the name it can be 20 characters, 35 characters or even longer.&lt;/P&gt;&lt;P&gt;Then follows a three digit number&lt;/P&gt;&lt;P&gt;After the number there is always a 02-02 followed by a date that is in a mmddyy10 format (although note that since all this is in one column the date is not formatted)&lt;/P&gt;&lt;P&gt;Following the date will be a four digit number with a "-" and then a small description, not sure the length of the description.&lt;/P&gt;&lt;P&gt;Finally there is a string of characters that always starts with "1-RT BE"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what the sample looks like:&lt;/P&gt;&lt;P&gt;4278 01234567&amp;nbsp; Auto Enroll Provider FAMILY HEACARE 008 02-02 01/01/2018 131.23 0287-HSP OUT SR&amp;nbsp; 1-RT&amp;nbsp;BE 009-COSNF&lt;/P&gt;&lt;P&gt;4273 34876539&amp;nbsp; Original Provider BURKE CENTER 003 02-02 01/01/2018 187.01 0287-HSP OUT SR&amp;nbsp;&amp;nbsp; 1-RT BE 010-COSNA&lt;/P&gt;&lt;P&gt;1468 04876298&amp;nbsp; Collapsed Provider PHOENIX RISES OF&amp;nbsp;NJ INC 005 02-02 01/01/2018 17.67 0160-D&amp;amp;TCS&amp;nbsp; 1-RT BE 009-COSNF &amp;nbsp;&lt;/P&gt;&lt;P&gt;1540 10983746&amp;nbsp; Genesis Provider COLLEGE PARK 016 02-02 01/01/2018 148.43 0160-D&amp;amp;TCS&amp;nbsp; 1-RT BE 013-INVRATECD&lt;/P&gt;&lt;P&gt;1671 34098734&amp;nbsp; Auto Enroll Provider THIS CNTY DOH&amp;nbsp; 004 02-02 01/01/2018 138.70 0287-HSP OUT SR&amp;nbsp; 1-RT BE 040-INVREQ&amp;nbsp;&lt;/P&gt;&lt;P&gt;1671 45398726&amp;nbsp; Auto Enroll Provider THAT CLINIC&amp;nbsp; 004 02-02 01/01/2018 138.70 0287-HSP OUT SR&amp;nbsp; 1-RT BE 009-COSNF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this is what I am trying to get to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Rate&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Provider&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;NAME&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;ProvID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;type&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;amount&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Desc&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;RT&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4278&lt;/TD&gt;&lt;TD&gt;01234567&lt;/TD&gt;&lt;TD&gt;Auto Enroll Provider&lt;/TD&gt;&lt;TD&gt;FAMILY HEALTHCARE&lt;/TD&gt;&lt;TD&gt;008&lt;/TD&gt;&lt;TD&gt;02-02&lt;/TD&gt;&lt;TD&gt;1/1/2018&lt;/TD&gt;&lt;TD&gt;131.23&lt;/TD&gt;&lt;TD&gt;0287-HSP OUT SR&lt;/TD&gt;&lt;TD&gt;1-RT BE 009-COSNF&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4273&lt;/TD&gt;&lt;TD&gt;34876539&lt;/TD&gt;&lt;TD&gt;Original Provider&lt;/TD&gt;&lt;TD&gt;BURKE HEALTH CENTER&lt;/TD&gt;&lt;TD&gt;003&lt;/TD&gt;&lt;TD&gt;02-02&lt;/TD&gt;&lt;TD&gt;1/1/2018&lt;/TD&gt;&lt;TD&gt;187.01&lt;/TD&gt;&lt;TD&gt;0287-HSP OUT SR&lt;/TD&gt;&lt;TD&gt;1-RT BE 010-COSNA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1468&lt;/TD&gt;&lt;TD&gt;04876298&lt;/TD&gt;&lt;TD&gt;Collapsed Provider&lt;/TD&gt;&lt;TD&gt;PHOENIX RISES OF NEW JESRSEY INC&lt;/TD&gt;&lt;TD&gt;005&lt;/TD&gt;&lt;TD&gt;02-02&lt;/TD&gt;&lt;TD&gt;1/1/2018&lt;/TD&gt;&lt;TD&gt;17.67&lt;/TD&gt;&lt;TD&gt;0160-D&amp;amp;TCS&lt;/TD&gt;&lt;TD&gt;1-RT BE 009-COSNF&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1540&lt;/TD&gt;&lt;TD&gt;10983746&lt;/TD&gt;&lt;TD&gt;Genesis Provider&lt;/TD&gt;&lt;TD&gt;COLLEGE PARK&lt;/TD&gt;&lt;TD&gt;016&lt;/TD&gt;&lt;TD&gt;02-02&lt;/TD&gt;&lt;TD&gt;1/1/2018&lt;/TD&gt;&lt;TD&gt;148.43&lt;/TD&gt;&lt;TD&gt;0160-D&amp;amp;TCS&lt;/TD&gt;&lt;TD&gt;1-RT BE 013-INVRATECD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1671&lt;/TD&gt;&lt;TD&gt;34098734&lt;/TD&gt;&lt;TD&gt;Auto Enroll Provider&lt;/TD&gt;&lt;TD&gt;THIS CNTY DOH&lt;/TD&gt;&lt;TD&gt;004&lt;/TD&gt;&lt;TD&gt;02-02&lt;/TD&gt;&lt;TD&gt;1/1/2018&lt;/TD&gt;&lt;TD&gt;138.7&lt;/TD&gt;&lt;TD&gt;0287-HSP OUT SR&lt;/TD&gt;&lt;TD&gt;1-RETR TO BE 040-INVREQ&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1671&lt;/TD&gt;&lt;TD&gt;45398726&lt;/TD&gt;&lt;TD&gt;Auto Enroll Provider&lt;/TD&gt;&lt;TD&gt;THAT CLINIC&lt;/TD&gt;&lt;TD&gt;004&lt;/TD&gt;&lt;TD&gt;02-02&lt;/TD&gt;&lt;TD&gt;1/1/2018&lt;/TD&gt;&lt;TD&gt;138.7&lt;/TD&gt;&lt;TD&gt;0287-HSP OUT SR&lt;/TD&gt;&lt;TD&gt;1-RT BE 009-COSNF&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suggestions?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 03:40:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430269#M106357</guid>
      <dc:creator>sas_student1</dc:creator>
      <dc:date>2018-01-24T03:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to serach for specific text within a string and create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430294#M106360</link>
      <description>&lt;P&gt;As you hav a space delimiter between variables use scan function to assign values to the variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also read the variables by INPUT statement without the&amp;nbsp;@ to assign starting position, but just&amp;nbsp;&lt;/P&gt;
&lt;P&gt;by assigning $ for char type variables, and preassign max length for each char type variable.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 05:40:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430294#M106360</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-01-24T05:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to serach for specific text within a string and create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430295#M106361</link>
      <description>&lt;P&gt;Thank you, it was pointed out to me that the example that I gave was not good as I would get a helpful response but not to my example and that was my mistake.&lt;/P&gt;&lt;P&gt;I have edited my original text with a better example.&lt;/P&gt;&lt;P&gt;You will note that I cannot use space delimiter, or @ because the dataset has provider names and descriptions that have space in them. Also the length for some of the elements are not known.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope my edited post helps clarify the type of dataset I have.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your assistance.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 06:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430295#M106361</guid>
      <dc:creator>sas_student1</dc:creator>
      <dc:date>2018-01-24T06:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to serach for specific text within a string and create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430298#M106362</link>
      <description>&lt;P&gt;i am no expert in regular expressions,&amp;nbsp; this code can be definitely enhanced or there could be better code. I got the results required for your sample. as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;explained more datapoint, the better the answer can be. Another important please set length of variable as you want(prxchange defaults the length to 200). I have fixed length for one variable&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input line $ 1-115;
datalines;
4278 01234567  Auto Enroll Provider FAMILY HEACARE 008 02-02 01/01/2018 131.23 0287-HSP OUT SR  1-RT BE 009-COSNF
4273 34876539  Original Provider BURKE CENTER 003 02-02 01/01/2018 187.01 0287-HSP OUT SR   1-RT BE 010-COSNA
1468 04876298  Collapsed Provider PHOENIX RISES OF NJ INC 005 02-02 01/01/2018 17.67 0160-D&amp;amp;TCS  1-RT BE 009-COSNF  
1540 10983746  Genesis Provider COLLEGE PARK 016 02-02 01/01/2018 148.43 0160-D&amp;amp;TCS  1-RT BE 013-INVRATECD
1671 34098734  Auto Enroll Provider THIS CNTY DOH  004 02-02 01/01/2018 138.70 0287-HSP OUT SR  1-RT BE 040-INVREQ 
1671 45398726  Auto Enroll Provider THAT CLINIC  004 02-02 01/01/2018 138.70 0287-HSP OUT SR  1-RT BE 009-COSNF
;
data want;
set have;
length rate $4;
rate =scan(line,1,'');
ID= scan(line,2,'') ;
provider = prxchange('s/(.+?)([A-Za-z\s]+?Provider)(.+)/$2/', -1, line);
*provider = prxchange('s/(.+?)(.+)/$2/', -1, line);
name= prxchange('s/(.+?[A-Za-z\s]+?Provider)([A-Z\s]+)(.+)/$2/', -1, line);
provid = prxchange('s/(.+?)([0-9]{3})(.+)/$2/', -1, line);
type = prxchange('s/(.+?)(\d{2}\-\d{2})(.+)/$2/', -1, line);
date = prxchange('s/(.+?)(\d{2}\/\d{2}\/\d{4})(.+)/$2/', -1, line);
amount = prxchange('s/(.+?)(\d{2}\/\d{2}\/\d{4}\s+)([0-9\.]+)(.+)/$3/', -1, line);
desc=prxchange('s/(.+?)(\d{2}\/\d{2}\/\d{4}\s+)([0-9\.]+\s+)(.+?)(1\-.+)/$4/', -1, line);
rt=prxchange('s/(.+?)(\d{2}\/\d{2}\/\d{4}\s+)([0-9\.]+\s+)(.+?)(1\-.+)/$5/', -1, line);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 16:21:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430298#M106362</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-01-24T16:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to serach for specific text within a string and create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430326#M106377</link>
      <description>&lt;P&gt;Unfortunately you have been provided with a garbage file format.&amp;nbsp; What this essentially means is your going to have to write a parser which process the string out in the various variables.&amp;nbsp; Me I would reject the file out of hand or increase costs associated with processing it.&amp;nbsp; Anyways to get you started, we know that the first four characters will be a number and goto variable 1 so:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  rate=input(substr(thestring,1,4),best.);
/* this trims off the bit we just took */
  thestring=substr(thestring,5);
  id=input(substr(thestring,1,8),best.);
  thestring=substr(thestring,9);
...
run;
&lt;/PRE&gt;
&lt;P&gt;So that does the first two.&amp;nbsp; From there on you just add your rules in one by one to get the various data parts out.&amp;nbsp; Or you point out that it is 2018 and these unstructured mess files are just not acceptable.&amp;nbsp; Just by putting a comma in between makes everyones life so much easier.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 09:37:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430326#M106377</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-01-24T09:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to serach for specific text within a string and create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430362#M106381</link>
      <description>&lt;P&gt;You may need work by try and error.&lt;/P&gt;
&lt;P&gt;Check next code and its results, the adapt length of variables if need:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example;
  infile datalines truncover;
  input a_line $140;
data lines;
4278 01234567  Auto Enroll Provider FAMILY HEACARE 008 02-02 01/01/2018 131.23 0287-HSP OUT SR  1-RT BE 009-COSNF

4273 34876539  Original Provider BURKE CENTER 003 02-02 01/01/2018 187.01 0287-HSP OUT SR   1-RT BE 010-COSNA

1468 04876298  Collapsed Provider PHOENIX RISES OF NJ INC 005 02-02 01/01/2018 17.67 0160-D&amp;amp;TCS  1-RT BE 009-COSNF  

1540 10983746  Genesis Provider COLLEGE PARK 016 02-02 01/01/2018 148.43 0160-D&amp;amp;TCS  1-RT BE 013-INVRATECD

1671 34098734  Auto Enroll Provider THIS CNTY DOH  004 02-02 01/01/2018 138.70 0287-HSP OUT SR  1-RT BE 040-INVREQ 

1671 45398726  Auto Enroll Provider THAT CLINIC  004 02-02 01/01/2018 138.70 0287-HSP OUT SR  1-RT BE 009-COSNF
;
run;

data test;
 set example;
     length var1 provider name $50; /* assumed max any variable length is 50 characters */
	 length type $5 desc $20 rt $20;  /* addapt to max length */
	 drop var1 len1 ix;
	 
     var1 = scan(a_line,1);
 	 len1 = length(strip(var1));
     rate = inputn(var1,best., len1);
	 a_line = substr(a_line, len1+1);  /* rest of line */
  /*-------------------------------------------------------------*/	 
	 var1 = scan(a_line,1);
 	 len1 = length(strip(var1));
     id   = inputn(var1,best., len1);
	 a_line = substr(a_line, len1+1);  /* rest of line */
  /*-------------------------------------------------------------*/	 
     ix = index(a_line, 'Provider');
	 len1 = ix + 8;  /* add 'Provider' length */
	 Provider = substr(a_line,1,len1);
	 a_line = substr(a_line, len1+1);  /* rest of line */
  /*-------------------------------------------------------------*/	 
     provid =  input(scan(a_line,1),3.);
	 type = scan(a_line,2);
	 date = input(scan(a_line,3),ddmmyy8.);
	 amount = input(scan(a_line,4),best7.2;
  /*-------------------------------------------------------------*/	 
     len1 = 23; /* sum length of provider type date &amp;amp; amount &amp;amp; gaps - assumed fix length */
	 a_line = substr(a_line, len1+1);  /* rest of line */
  /*-------------------------------------------------------------*/	 
     desc = scan(a_line,1);
	 rt = scan(a_line,2);
run;	  &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Jan 2018 11:41:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430362#M106381</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-01-24T11:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to serach for specific text within a string and create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430524#M106418</link>
      <description>&lt;P&gt;&lt;FONT size="6"&gt;&lt;STRONG&gt;Large economy sized hint:&lt;/STRONG&gt;&lt;FONT size="3"&gt; Post your example data into a code box and not the main message window. Open a code box with the forum {I} icon.&amp;nbsp;There is a chance that your data is actually fixed column, which is very easy to read when identified, but this forum will reformat pasted data and possibly removed the duplicate blanks likely in your original data.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="6"&gt;&lt;FONT size="3"&gt;OR copy the text from a text editor and not any other type program such as Word as they may "helpfully" reformat text without telling you.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 16:27:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430524#M106418</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-24T16:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to serach for specific text within a string and create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430562#M106437</link>
      <description>&lt;P&gt;Thank you Sooo much!!! this did exactly what I needed!&lt;/P&gt;&lt;P&gt;And this worked on the 99.99% of the data.&lt;/P&gt;&lt;P&gt;The one that it did not work on (oddly) was on the code that created provid. It was supposed to capture the three digit after the name variable (i.e. 008, 003, 005 etc.) but interestingly it captured and displayed three digits from the rate variable? suggestions on how to fix that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW. I checked and double checked and&amp;nbsp;there were no delimiters (space, tab or any other items ) that I could possibly use, but the PRXchange worked!!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I knew there were people here who were savvy with SAS that even if given a dataset that at this time and age one should not be getting we had people who could figure it out!!!&lt;/P&gt;&lt;P&gt;You all are awesome!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input line $ 1-115;
datalines;
4278 01234567  Auto Enroll Provider FAMILY HEACARE 008 02-02 01/01/2018 131.23 0287-HSP OUT SR  1-RT BE 009-COSNF
4273 34876539  Original Provider BURKE CENTER 003 02-02 01/01/2018 187.01 0287-HSP OUT SR   1-RT BE 010-COSNA
1468 04876298  Collapsed Provider PHOENIX RISES OF NJ INC 005 02-02 01/01/2018 17.67 0160-D&amp;amp;TCS  1-RT BE 009-COSNF  
1540 10983746  Genesis Provider COLLEGE PARK 016 02-02 01/01/2018 148.43 0160-D&amp;amp;TCS  1-RT BE 013-INVRATECD
1671 34098734  Auto Enroll Provider THIS CNTY DOH  004 02-02 01/01/2018 138.70 0287-HSP OUT SR  1-RT BE 040-INVREQ 
1671 45398726  Auto Enroll Provider THAT CLINIC  004 02-02 01/01/2018 138.70 0287-HSP OUT SR  1-RT BE 009-COSNF
;
data want;
set have;
length rate $4;
rate =scan(line,1,'');
ID= scan(line,2,'') ;
provider = prxchange('s/(.+?)([A-Za-z\s]+?Provider)(.+)/$2/', -1, line);
*provider = prxchange('s/(.+?)(.+)/$2/', -1, line);
name= prxchange('s/(.+?[A-Za-z\s]+?Provider)([A-Z\s]+)(.+)/$2/', -1, line);
provid = prxchange('s/(.+?)([0-9]{3})(.+)/$2/', -1, line);
type = prxchange('s/(.+?)(\d{2}\-\d{2})(.+)/$2/', -1, line);
date = prxchange('s/(.+?)(\d{2}\/\d{2}\/\d{4})(.+)/$2/', -1, line);
amount = prxchange('s/(.+?)(\d{2}\/\d{2}\/\d{4}\s+)([0-9\.]+)(.+)/$3/', -1, line);
desc=prxchange('s/(.+?)(\d{2}\/\d{2}\/\d{4}\s+)([0-9\.]+\s+)(.+?)(1\-.+)/$4/', -1, line);
rt=prxchange('s/(.+?)(\d{2}\/\d{2}\/\d{4}\s+)([0-9\.]+\s+)(.+?)(1\-.+)/$5/', -1, line);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 17:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430562#M106437</guid>
      <dc:creator>sas_student1</dc:creator>
      <dc:date>2018-01-24T17:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to serach for specific text within a string and create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430620#M106444</link>
      <description>&lt;P&gt;Only one change was needed to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37783"&gt;@kiranv_&lt;/a&gt;'s code to parse provID:&lt;/P&gt;
&lt;PRE&gt;data have;
  input line $ 1-115;
  datalines;
4278 01234567  Auto Enroll Provider FAMILY HEACARE 008 02-02 01/01/2018 131.23 0287-HSP OUT SR  1-RT BE 009-COSNF
4273 34876539  Original Provider BURKE CENTER 003 02-02 01/01/2018 187.01 0287-HSP OUT SR   1-RT BE 010-COSNA
1468 04876298  Collapsed Provider PHOENIX RISES OF NJ INC 005 02-02 01/01/2018 17.67 0160-D&amp;amp;TCS  1-RT BE 009-COSNF  
1540 10983746  Genesis Provider COLLEGE PARK 016 02-02 01/01/2018 148.43 0160-D&amp;amp;TCS  1-RT BE 013-INVRATECD
1671 34098734  Auto Enroll Provider THIS CNTY DOH  004 02-02 01/01/2018 138.70 0287-HSP OUT SR  1-RT BE 040-INVREQ 
1671 45398726  Auto Enroll Provider THAT CLINIC  004 02-02 01/01/2018 138.70 0287-HSP OUT SR  1-RT BE 009-COSNF
;
data want (drop=line);
  set have;
  length rate $4;
  rate =scan(line,1,'');
  ID= scan(line,2,'') ;
  provider = prxchange('s/(.+?)([A-Za-z\s]+?Provider)(.+)/$2/', -1, line);
  name= prxchange('s/(.+?[A-Za-z\s]+?Provider)([A-Z\s]+)(.+)/$2/', -1, line);
  provid = prxchange('s/(.+?)(\s)([0-9]{3})(\s)(.+)/$3/',-1,  line);
  type = prxchange('s/(.+?)(\d{2}\-\d{2})(.+)/$2/', -1, line);
  date = prxchange('s/(.+?)(\d{2}\/\d{2}\/\d{4})(.+)/$2/', -1, line);
  amount = prxchange('s/(.+?)(\d{2}\/\d{2}\/\d{4}\s+)([0-9\.]+)(.+)/$3/', -1, line);
  desc=prxchange('s/(.+?)(\d{2}\/\d{2}\/\d{4}\s+)([0-9\.]+\s+)(.+?)(1\-.+)/$4/', -1, line);
  rt=prxchange('s/(.+?)(\d{2}\/\d{2}\/\d{4}\s+)([0-9\.]+\s+)(.+?)(1\-.+)/$5/', -1, line);
run;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 19:41:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430620#M106444</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-24T19:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to serach for specific text within a string and create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430641#M106449</link>
      <description>&lt;P&gt;YES!!!!! Thank you! This Worked!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are all the best!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 20:00:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-serach-for-specific-text-within-a-string-and-create-a-new/m-p/430641#M106449</guid>
      <dc:creator>sas_student1</dc:creator>
      <dc:date>2018-01-24T20:00:05Z</dc:date>
    </item>
  </channel>
</rss>

