<?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: Split variable &amp;gt;200 char into fragments &amp;lt;200 char but keep words whole in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/297232#M270264</link>
    <description>&lt;P&gt;This looks like the easiest way to find the cut point.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cut = findc(x,' ',-200);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I don't see why you need to bother won't the consumer of your XPORT file just glue&amp;nbsp;the cut up text back together in one variable.&amp;nbsp; You could even supply the program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Sep 2016 19:04:08 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2016-09-08T19:04:08Z</dc:date>
    <item>
      <title>Split variable &gt;200 char into fragments &lt;200 char but keep words whole</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/297203#M270260</link>
      <description>&lt;P&gt;I am trying to split a variable that&amp;nbsp;contains some&amp;nbsp;values which are&amp;nbsp;more than 200 char into two variables that contain only values&amp;nbsp;less than 200 char without cutting&amp;nbsp;any word in half.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2016 15:53:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/297203#M270260</guid>
      <dc:creator>Adambo</dc:creator>
      <dc:date>2016-09-08T15:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Split variable &gt;200 char into fragments &lt;200 char but keep words whole</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/297208#M270261</link>
      <description>&lt;P&gt;How much longer than 200 characters is the source?&lt;/P&gt;
&lt;P&gt;This may give you an idea. This assumes that you want to break on spaces only, add comma,period or other possible break characters to the second parameter of FINDC. This also assumes that you aren't likely to have any single word longer than 20 characters.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example;
   x= "This is a really long string that I want to split into two strings of less than 200 characters. The current length is going to be a randome collection of words untill I get something long enough to split. Of course we may have some issues with how the long the longest individula word may be in the source string but that's life.";
   length string1 string2 $ 200;
   if length(x) &amp;lt; 200 then String1=X;
   Else do;
      string1 = substr(x,1,findc(x,' ',180));
      string2 = substr(x,findc(x,' ',180));
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Sep 2016 16:38:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/297208#M270261</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-08T16:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: Split variable &gt;200 char into fragments &lt;200 char but keep words whole</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/297213#M270262</link>
      <description>&lt;P&gt;Just because I've seen medical dictionaries with several words longer than 40 characters apiece, I would modify the ELSE DO section:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;else do i=201 to 1 by -1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; if substr(x, i, 1) = ' ' then do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string1 = substr(x, 1, i-1);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string2 = left(substr(x, i+1));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2016 16:57:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/297213#M270262</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-09-08T16:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Split variable &gt;200 char into fragments &lt;200 char but keep words whole</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/297230#M270263</link>
      <description>&lt;P&gt;Brilliant.&amp;nbsp;I actually&amp;nbsp;need&amp;nbsp;this&amp;nbsp;to&amp;nbsp;make medical chart verbatim&amp;nbsp;fit into&amp;nbsp;SAS V5&amp;nbsp;transport files which have this $200. restriction. Thanks. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2016 18:36:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/297230#M270263</guid>
      <dc:creator>Adambo</dc:creator>
      <dc:date>2016-09-08T18:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: Split variable &gt;200 char into fragments &lt;200 char but keep words whole</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/297232#M270264</link>
      <description>&lt;P&gt;This looks like the easiest way to find the cut point.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cut = findc(x,' ',-200);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I don't see why you need to bother won't the consumer of your XPORT file just glue&amp;nbsp;the cut up text back together in one variable.&amp;nbsp; You could even supply the program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2016 19:04:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/297232#M270264</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-09-08T19:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: Split variable &gt;200 char into fragments &lt;200 char but keep words whole</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/298404#M270265</link>
      <description>&lt;P&gt;Thank you very much. It is working for me. The variables are of different lengths. How to find exactly number of characters(length) in a variable value. Do you have any suggestions. Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 18:50:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/298404#M270265</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2016-09-14T18:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Split variable &gt;200 char into fragments &lt;200 char but keep words whole</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/298405#M270266</link>
      <description>&lt;P&gt;The LENGTHN function will do that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;n_characters = lengthn(varname);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similarly, there is a LENGTH function.&amp;nbsp; It is almost identical, but returns a 1 instead of a 0 when the incoming variable is blank.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 18:52:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-variable-gt-200-char-into-fragments-lt-200-char-but-keep/m-p/298405#M270266</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-09-14T18:52:26Z</dc:date>
    </item>
  </channel>
</rss>

