<?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: Trim data by x characters in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Trim-data-by-x-characters/m-p/69987#M20152</link>
    <description>You will have to explain a bit better what you have and what you want. May be you give us also some examples.</description>
    <pubDate>Mon, 19 Jan 2009 11:51:50 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2009-01-19T11:51:50Z</dc:date>
    <item>
      <title>Trim data by x characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trim-data-by-x-characters/m-p/69986#M20151</link>
      <description>I have a dataset that has a variable with a prefix code the a description.&lt;BR /&gt;
&lt;BR /&gt;
I want to trim the variable by the number of characters the prefix code has but the prefix code can be 4, 5, 6, 7 or 8 characters long.&lt;BR /&gt;
&lt;BR /&gt;
Is there a way of trimming the data using a procedure?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Mon, 19 Jan 2009 08:46:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trim-data-by-x-characters/m-p/69986#M20151</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-01-19T08:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trim data by x characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trim-data-by-x-characters/m-p/69987#M20152</link>
      <description>You will have to explain a bit better what you have and what you want. May be you give us also some examples.</description>
      <pubDate>Mon, 19 Jan 2009 11:51:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trim-data-by-x-characters/m-p/69987#M20152</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2009-01-19T11:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: Trim data by x characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trim-data-by-x-characters/m-p/69988#M20153</link>
      <description>The method of trimming a prefix is determined by how the prefix is defined.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The simplest way is for the prefix code and the remaining data to be separated by a unique character, say ':'.  Then you can use the "scan" function as in below&lt;BR /&gt;
&lt;BR /&gt;
trimmed = scan (prefixed, 2, ':');&lt;BR /&gt;
&lt;BR /&gt;
OR&lt;BR /&gt;
&lt;BR /&gt;
trimmed = scan (prefixed, -1, ':' );&lt;BR /&gt;
&lt;BR /&gt;
A more complicated method would be that the prefix is required to be lower case and the first character of the real data is capitalized.  Then you would have to use a do loop (do while or do until), the substr function and either the ANYLOWER or ANYUPPER function to find the beginning of the real, non-prefixed, data.</description>
      <pubDate>Mon, 19 Jan 2009 15:30:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trim-data-by-x-characters/m-p/69988#M20153</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-01-19T15:30:17Z</dc:date>
    </item>
  </channel>
</rss>

