<?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 How to handle with length truncation and replacing with valuable information in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-with-length-truncation-and-replacing-with-valuable/m-p/467321#M119291</link>
    <description>&lt;P&gt;I have a text string and with length set and if the string is more than the length it gets truncated in middle. Can i handle such a way if it truncates a word in middle than replace it with "etc."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data inc;
   length text $200.;	
   text="The man has a caregiver or an identified responsible person (for example, family member, social worker, case worker, or nurse) considered reliable by the nature in providing support to the headlines meeeting";
run;&lt;/PRE&gt;
&lt;P&gt;This truncates -The man has a caregiver or an identified responsible person (for example, family member, social worker, case worker, or nurse) considered reliable by the nature in providing support to the headlines m&lt;/P&gt;
&lt;P&gt;Can i replace "headlines m" with etc.. so that it makes some sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help on how to handle this&lt;/P&gt;</description>
    <pubDate>Mon, 04 Jun 2018 08:30:01 GMT</pubDate>
    <dc:creator>vraj1</dc:creator>
    <dc:date>2018-06-04T08:30:01Z</dc:date>
    <item>
      <title>How to handle with length truncation and replacing with valuable information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-with-length-truncation-and-replacing-with-valuable/m-p/467321#M119291</link>
      <description>&lt;P&gt;I have a text string and with length set and if the string is more than the length it gets truncated in middle. Can i handle such a way if it truncates a word in middle than replace it with "etc."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data inc;
   length text $200.;	
   text="The man has a caregiver or an identified responsible person (for example, family member, social worker, case worker, or nurse) considered reliable by the nature in providing support to the headlines meeeting";
run;&lt;/PRE&gt;
&lt;P&gt;This truncates -The man has a caregiver or an identified responsible person (for example, family member, social worker, case worker, or nurse) considered reliable by the nature in providing support to the headlines m&lt;/P&gt;
&lt;P&gt;Can i replace "headlines m" with etc.. so that it makes some sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help on how to handle this&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 08:30:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-handle-with-length-truncation-and-replacing-with-valuable/m-p/467321#M119291</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2018-06-04T08:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle with length truncation and replacing with valuable information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-with-length-truncation-and-replacing-with-valuable/m-p/467331#M119292</link>
      <description>&lt;P&gt;Bump up the length slightly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;length text $ 203;&lt;/P&gt;
&lt;P&gt;text = " ........";&lt;/P&gt;
&lt;P&gt;if length(text) &amp;gt; 200 then&amp;nbsp;text = substr(text, 1, 195) || ' etc.';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 09:53:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-handle-with-length-truncation-and-replacing-with-valuable/m-p/467331#M119292</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-04T09:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle with length truncation and replacing with valuable information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-with-length-truncation-and-replacing-with-valuable/m-p/467337#M119293</link>
      <description>&lt;P&gt;I cannot do as the length of the string should only be 200 and not more than that. so need to adjust the data&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 10:11:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-handle-with-length-truncation-and-replacing-with-valuable/m-p/467337#M119293</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2018-06-04T10:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle with length truncation and replacing with valuable information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-with-length-truncation-and-replacing-with-valuable/m-p/467339#M119295</link>
      <description>&lt;P&gt;Hello, I think this should work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data inc;
    length text $200. text196 txet $196.;	
    text="The man has a caregiver or an identified responsible person (for example, family member, social worker, case worker, or nurse) considered reliable by the nature in providing support to the headlines meeeting";

    if length(text)&amp;gt;196 then do;
        text=substr(text,1,197-index(reverse(substrn(text,1,196))," ") )||"etc.";
    end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Jun 2018 10:40:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-handle-with-length-truncation-and-replacing-with-valuable/m-p/467339#M119295</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-06-04T10:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle with length truncation and replacing with valuable information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-with-length-truncation-and-replacing-with-valuable/m-p/467340#M119296</link>
      <description>&lt;P&gt;This will find the last blank from which it is possible to append the 'etc.' and don't cut a word in half right before it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
length newtext $200.;
text="The man has a caregiver or an identified responsible person (for example, family member, social worker, case worker, or nurse) considered reliable by the nature in providing support to the headlines meeeting";
newtext = text;
index = findc(newtext,' ','b');
if index &amp;gt; 195
then do;
  newtext = substr(newtext,1,index);
  index = findc(substr(newtext,1,index-1),' ','b');
end;
newtext = substr(newtext,1,index) !! 'etc.';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Jun 2018 11:00:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-handle-with-length-truncation-and-replacing-with-valuable/m-p/467340#M119296</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-04T11:00:20Z</dc:date>
    </item>
  </channel>
</rss>

