<?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: Splitting a string in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112845#M31235</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;var1=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast of having the storm this weekend.I hate going to the groceries.I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast of having the storm this weekend.I hate going to the groceries.I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast of having the storm this weekend.I hate going to the groceries."&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; cats(ceil(max(length(var1))/&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;200&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;)) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; :dim &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; split(&amp;amp;dim) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;$200.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; xxTERM1-xxTERM&amp;amp;dim;j=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; i=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;dim &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;WHILE&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (not missing(scan(var1,j))); &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; len=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; j=j &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt; &lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;while&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (not missing(scan(var1,j)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; length(scan(var1,j))+len&amp;gt;&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;200&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;leave&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; split(i)=catx(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,split(i),scan(var1,j));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; len=length(split(i));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;keep&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; xx:;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;Haikuo&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Jun 2013 00:40:58 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2013-06-20T00:40:58Z</dc:date>
    <item>
      <title>Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112842#M31232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to split a string at less than 200 character in order to derive SDTM variable like DVTERMxx? My variable value has a length of 650 character so my assumption is it ends up in 4 variables. I am not sure. Any help will be appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 20:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112842#M31232</guid>
      <dc:creator>DJ09</dc:creator>
      <dc:date>2013-06-19T20:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112843#M31233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An example of what you have and what the output should be would help. Differe types of string values may be manipulated easiest with different approaches. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 20:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112843#M31233</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-06-19T20:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112844#M31234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is an example:&lt;/P&gt;&lt;P&gt;Var1= I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast of having the storm this weekend.I hate going to the groceries.I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast of having the storm this weekend.I hate going to the groceries.I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast of having the storm this weekend.I hate going to the groceries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to split this var at 200 character without chopping any word but get close to 200 and make the first 200 as&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt; my first var like xxTERM and the rest of &lt;/SPAN&gt;the&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt; string will go to the next variable xxTERM01 , xxTERM02 and so on. I hope this make sense?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 20:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112844#M31234</guid>
      <dc:creator>DJ09</dc:creator>
      <dc:date>2013-06-19T20:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112845#M31235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;var1=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast of having the storm this weekend.I hate going to the groceries.I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast of having the storm this weekend.I hate going to the groceries.I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast of having the storm this weekend.I hate going to the groceries."&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; cats(ceil(max(length(var1))/&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;200&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;)) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; :dim &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; split(&amp;amp;dim) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;$200.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; xxTERM1-xxTERM&amp;amp;dim;j=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; i=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;dim &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;WHILE&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (not missing(scan(var1,j))); &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; len=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; j=j &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt; &lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;while&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (not missing(scan(var1,j)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; length(scan(var1,j))+len&amp;gt;&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;200&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;leave&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; split(i)=catx(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,split(i),scan(var1,j));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; len=length(split(i));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;keep&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; xx:;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;Haikuo&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jun 2013 00:40:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112845#M31235</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-06-20T00:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112846#M31236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-family: arial,helvetica,sans-serif;"&gt;If you don't want to keep var1 in the output dataset then try this. The proc sql setting the variable dim by &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;Haikuo &lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;needs further testing. As long as your text contains short words, using ceil will most likely provide a number large enough to create the required number of substring-variables. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: navy; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;noprint&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt; ceil(max(length(var1)) / &lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: teal; background: white;"&gt;200&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt; :dim separated by &lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: purple; background: white;"&gt;'' /* strips leading blanks */&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt; have&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Part01-Part&amp;amp;dim $ &lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: teal; background: white;"&gt;200&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i &lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: teal; background: white;"&gt;8&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt; parts Part:;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i = &lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: teal; background: white;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;do&lt;/SPAN&gt; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;while&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt; (length(Var1) &amp;gt; &lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: teal; background: white;"&gt;200&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; blankPos = find(var1, &lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: purple; background: white;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;, -&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: teal; background: white;"&gt;200&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parts&lt;I&gt; = substr(Var1, &lt;/I&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: teal; background: white;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;, blankPos -&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: teal; background: white;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i = i + &lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: teal; background: white;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var1 = substr(Var1, blankPos);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt; length(var1) &amp;gt; &lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: teal; background: white;"&gt;0&lt;/SPAN&gt; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parts&lt;I&gt; = var1;&lt;/I&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: Consolas; color: blue; background: white;"&gt;drop&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt; var1 i blankPos &lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: green; background: white;"&gt;/*Buffer*/&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jun 2013 07:37:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112846#M31236</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2013-06-20T07:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112847#M31237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or transpose it into vertical.&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 have;
length var1 $ 4000 ;
var1='I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast of having the storm this weekend.I hate going to the groceries.I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast of having the storm this weekend.I hate going to the groceries.I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast of having the storm this weekend.I hate going to the groceries.';
output;
var1='I am going to market to get some groceries.I will not return till the evening. If there is anyway possible for you to cook the dinner.I will not return till the evening. If there is anyway possible for you to cook the dinner.I will not return till the evening. If there is anyway possible for you to cook the dinner.I will not return till the evening. If there is anyway possible for you to cook the dinner.I will not return till the evening. If there is anyway possible for you to cook the dinner.';
output;
run;
data temp(keep=id x);
 set have;
 id=_n_;
 do i=1 to countw(var1,' ');
&amp;nbsp; x=scan(var1,i,' ');
&amp;nbsp; output;
 end;
run;
data temp;
 set temp;
 length xx $ 400;
 retain xx;
 retain n 1;
 xx=catx(' ',xx,x);
 if&amp;nbsp; id ne lag(id) then do;n=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xx=x;end;
 if length(xx) gt 200&amp;nbsp; then do;n+1;xx=x;end;
 run;
 data x;
&amp;nbsp; set temp;
&amp;nbsp; by n notsorted;
&amp;nbsp; if last.n;
run;
 
 proc transpose data=x out=want prefix=temp;
 by id;
 id n;
 var xx;
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;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jun 2013 09:51:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112847#M31237</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-06-20T09:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112848#M31238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a couple of questions in the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt; set temp;&lt;/P&gt;&lt;P&gt; length xx $ 400;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;----length of var1 was 40000 and why are we giving a length of only 400 to xx??????&lt;/P&gt;&lt;P&gt; retain xx;&lt;/P&gt;&lt;P&gt; retain n 1; &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;----------------------------does this mean n variable to have a length of 1 while it retains???&lt;/P&gt;&lt;P&gt; xx=catx(' ',xx,x);&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;if&amp;nbsp; id ne lag(id) then do;n=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xx=x;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; if length(xx) gt 200&amp;nbsp; then do;n+1;xx=x;end;&amp;nbsp;&amp;nbsp; /*i also have difficulty in understanding what these 2 lines of code does???*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 20:16:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112848#M31238</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-07-02T20:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112849#M31239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you just want to chop into 200 character pieces then just do it.&lt;/P&gt;&lt;P&gt;Let's say you have variable that is 650.&amp;nbsp; So that will take 4 pieces, 1-200, 201-400, 401-600 and 601 on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array _x $200 DVTERM01 - DVTERM04&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 650 by 200 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _x(i) = substr(dvterm,i);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jul 2013 01:19:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112849#M31239</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-07-03T01:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112850#M31240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;length xx $ 400; &lt;/TD&gt;&lt;TD&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;----length of var1 was 40000 and why are we giving a length of only 400 to xx??????&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is used to hold a variable which has $200. you need . I make it as $400. is to make sure greater than $200, and we can judge if its length is greater than $200 or not. (&lt;STRONG&gt;if length(xx) gt 200 &lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"retain n 1; &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;----------------------------does this mean n variable to have a length of 1 while it retains???"&lt;/P&gt;&lt;P&gt;no, it means n is numeric variable and its initiative value is 1 . &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;STRONG&gt;if&amp;nbsp; id ne lag(id) then do;n=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xx=x;end;"&lt;/STRONG&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;at the beginning of every group, I initiative xx as x (xx has the same value with x).and reinstate group id (variable n) as 1.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; "if length(xx) gt 200&amp;nbsp; then do;n+1;xx=x;end;&amp;nbsp;&amp;nbsp; /*i also have difficulty in understanding what these 2 lines of code does???*/"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I make several groups (variable n), each group 's length ( variable xx 's length) is not greater than 200 which you need to split.&lt;/P&gt;&lt;P&gt;Actually here xx variable is what we need, then proc transpose to make it what we finally want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: xia keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jul 2013 02:19:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112850#M31240</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-07-03T02:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112851#M31241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I like better the solution given by andreas_Ids than the first one presented by Ksharp. It's more clear, more simple and did not lose the dots that var1 contais to separate the sentences.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jul 2013 19:03:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112851#M31241</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2013-07-05T19:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112852#M31242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@CTorres: But that solution will fail if a sufficiently long word exists in the last split that would cause 5 parts rather than 4 even though the string length is 800.&amp;nbsp; Below is such a case where the code would fail, along with code that wouldn't fail given a string like that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have (drop=i);&lt;/P&gt;&lt;P&gt;&amp;nbsp; var1="I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast ofhaving the storm this weekend.I hate going to the groceries.I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast of having the storm this weekend.I hate going to the groceries.I am going to market to get some groceries. I will not return till the evening. If there is anyway possible for you to cook the dinner. I am sure the grocery stores may be busy due to the forecast of having the storm this weekend.I hate going to those open allnight grocery stores.";&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 1000;output;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data need (keep=_line _partnum part);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length part $200;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _line+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _partnum=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; j=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do WHILE (not missing(scan(var1,j,' ')));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if length(catx(' ',part,scan(var1,j,' '))) gt 200 or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; missing(scan(var1,j+1,' ')) then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _partnum+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; part=scan(var1,j,' ');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else part=catx(' ',part,scan(var1,j,' '));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; j+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=need out=want (drop=_:) prefix=part;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var part;&lt;/P&gt;&lt;P&gt;&amp;nbsp; id _partnum;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by _line;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jul 2013 20:41:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112852#M31242</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-07-05T20:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112853#M31243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BTW. my code will still keep the dots variable contains . &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jul 2013 01:28:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112853#M31243</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-07-06T01:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112854#M31244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I find the following quite useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET DIM&amp;nbsp; = ;&lt;/P&gt;&lt;P&gt;%LET DSID = %SYSFUNC(OPEN(HAVE,I));&lt;/P&gt;&lt;P&gt;%LET DIM&amp;nbsp; = %SYSFUNC(CEIL(%EVAL(%SYSFUNC(VARLEN(&amp;amp;DSID,%SYSFUNC(VARNUM(&amp;amp;DSID,STDM))))/200)));&lt;/P&gt;&lt;P&gt;%LET RC&amp;nbsp;&amp;nbsp; = %SYSFUNC(CLOSE(&amp;amp;DSID));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA WANT ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET HAVE;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ARRAY SPLITIT $200 DVTERM1-DVTERM&amp;amp;DIM. _CHARACTER_;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; DO I = 1 TO &amp;amp;DIM.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPLITIT{I} = SUBSTR(STDM,(I-1)*200+1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%PUT &amp;amp;DIM.;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 12:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112854#M31244</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2013-07-08T12:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112855#M31245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I ran through the code again.&lt;/P&gt;&lt;P&gt;I was wondering about the following statement:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if&amp;nbsp; id ne lag(id) then do;n=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xx=x;end;"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;There are 151 words in the first statement&lt;/P&gt;&lt;P&gt;there are 94 words in the second statement&lt;/P&gt;&lt;P&gt;lag(id) is the same for the first 151 records except for the 1st record so n&amp;nbsp; should not equls 1.But to my surprise I find n=1 after running this code&lt;/P&gt;&lt;P&gt;Could some one explain to me please...Same with the other 94 records&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2013 13:03:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112855#M31245</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-07-16T13:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112856#M31246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually it equals&amp;nbsp;&amp;nbsp; if first.id then .............&lt;/P&gt;&lt;P&gt;when it is the first obs of group id (first.id) then assign the first word of 151 words to variable xx and n=1;&lt;/P&gt;&lt;P&gt;at this time, if length(xx) gt 200&amp;nbsp; will evaluate the first word 's length ,it should not be great than 200 so n will not +1 .&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>Wed, 17 Jul 2013 05:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/112856#M31246</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-07-17T05:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/290572#M59766</link>
      <description>&lt;P&gt;Here is another example which will work in all scenarios.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data inds;&lt;BR /&gt;&amp;nbsp;invar = "There was once a merchant who employed many carpenters and masons to build a temple in his garden. Regularly, they would start work in the morning; The Monkey And The Wedge - Panchatantra Story Pictureand take a break for the mid-day meals, and return to resume work till evening. One day, a group of monkey arrived at the site of the building and watched the workers leaving for their mid-day meals. One of the carpenters was sawing a huge log of wood. Since, it was only half-done; he placed a wedge in between to prevent the log from closing up. He then went off along with the other workers for his meal.";&lt;BR /&gt;&amp;nbsp;output;&lt;BR /&gt;&amp;nbsp;invar = "Small string";&lt;BR /&gt;&amp;nbsp;output;&lt;BR /&gt;&amp;nbsp;invar = " ";&lt;BR /&gt;&amp;nbsp;output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data outds_row;&lt;BR /&gt;&amp;nbsp;set inds;&lt;BR /&gt;&amp;nbsp;obs_seq = _n_;&lt;BR /&gt;&amp;nbsp;length outvar $200;&lt;BR /&gt;&amp;nbsp;sub_invar = invar;&lt;BR /&gt;&amp;nbsp;itrno = 0;&lt;BR /&gt;&amp;nbsp;do until (sub_invar = " ");&lt;BR /&gt;&amp;nbsp; dlmpos = 199 - lengthn(scan(reverse(substrn(sub_invar, 1, 200)), 1, " "));&lt;BR /&gt;&amp;nbsp; outvar = strip(substrn(sub_invar, 1, dlmpos));&lt;BR /&gt;&amp;nbsp; sub_invar = strip(substrn(sub_invar, dlmpos + 1));&lt;BR /&gt;&amp;nbsp; itrno + 1;&lt;BR /&gt;&amp;nbsp; output;&lt;BR /&gt;&amp;nbsp;end;&lt;BR /&gt;&amp;nbsp;drop sub_invar dlmpos;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data = outds_row;&lt;BR /&gt;&amp;nbsp;by obs_seq itrno;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc transpose data = outds_row out = outds_col prefix = outvar;&lt;BR /&gt;&amp;nbsp;by obs_seq;&lt;BR /&gt;&amp;nbsp;id itrno;&lt;BR /&gt;&amp;nbsp;var outvar;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 20:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-string/m-p/290572#M59766</guid>
      <dc:creator>SPChoudary</dc:creator>
      <dc:date>2016-08-09T20:36:27Z</dc:date>
    </item>
  </channel>
</rss>

