<?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: replacing text causes string to cut off in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/replacing-text-causes-string-to-cut-off/m-p/139944#M37426</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Works for me:&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;temptext=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'&amp;lt;td&amp;gt;Temp 1&amp;lt;/td&amp;gt;&amp;nbsp; '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;txt=tranwrd(temptext, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'Temp'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'Temporary'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;put&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; temptext= / txt=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;What is the EXACT code you used?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;Update: Oh, the cut-off is probably due to the length setting of your new variable 'txt', if not specified, the default is 200. So assign a proper length before process the string.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;Update2: Here is to vent a little. This is one inconsistency that I feel SAS can improve. Some functions will take the length of precessed variable (such as SUBSTR(), which I like), Some will take something else, such as this one: 200. I know this is a legacy issue resulting from different developers and is common seen in many other programming languages as well, but I still feel SAS can do better to further lift those stress put on the shoulder of programmers. Similar &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;inconsistency&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; also happened to TRANWRD VS TRANSLATE regarding how they align their arguments. The order differences of 'source' and 'target' makes me quit remembering.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;Haikuo &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Jan 2015 14:45:23 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2015-01-27T14:45:23Z</dc:date>
    <item>
      <title>replacing text causes string to cut off</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/replacing-text-causes-string-to-cut-off/m-p/139943#M37425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some html text in one of my data sets.&amp;nbsp; I need to replace all occurrences of 'Temp' to 'Temporary'.&lt;/P&gt;&lt;P&gt;When I do the following it cuts the string off.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14223688740068740" jivemacro_uid="_14223688740068740" modifiedtitle="true"&gt;
&lt;P&gt;txt = tranwrd(temptext, 'Temp', 'Temporary') ;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my full html string&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14223689227297671" jivemacro_uid="_14223689227297671" modifiedtitle="true"&gt;
&lt;P&gt;&amp;lt;tr&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;td&amp;gt;Temp 1&amp;lt;/td&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;td&amp;gt;07/23/2015&amp;lt;/td&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/tr&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;tr&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;td&amp;gt;Temp 4&amp;lt;/td&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;td&amp;gt;03/05/2016&amp;lt;/td&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/tr&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;tr&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;td&amp;gt;Temp 8&amp;lt;/td&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;td&amp;gt;04/13/2017&amp;lt;/td&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/tr&amp;gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after running the above code txt variable only has&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14223689669021173" jivemacro_uid="_14223689669021173" modifiedtitle="true"&gt;
&lt;P&gt;&amp;lt;tr&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;td&amp;gt;Temp 1&amp;lt;/td&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;td&amp;gt;07/23/2015&amp;lt;/td&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/tr&amp;gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure why this is happening. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for any help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 14:30:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/replacing-text-causes-string-to-cut-off/m-p/139943#M37425</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2015-01-27T14:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: replacing text causes string to cut off</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/replacing-text-causes-string-to-cut-off/m-p/139944#M37426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Works for me:&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;temptext=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'&amp;lt;td&amp;gt;Temp 1&amp;lt;/td&amp;gt;&amp;nbsp; '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;txt=tranwrd(temptext, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'Temp'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'Temporary'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;put&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; temptext= / txt=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;What is the EXACT code you used?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;Update: Oh, the cut-off is probably due to the length setting of your new variable 'txt', if not specified, the default is 200. So assign a proper length before process the string.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;Update2: Here is to vent a little. This is one inconsistency that I feel SAS can improve. Some functions will take the length of precessed variable (such as SUBSTR(), which I like), Some will take something else, such as this one: 200. I know this is a legacy issue resulting from different developers and is common seen in many other programming languages as well, but I still feel SAS can do better to further lift those stress put on the shoulder of programmers. Similar &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;inconsistency&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; also happened to TRANWRD VS TRANSLATE regarding how they align their arguments. The order differences of 'source' and 'target' makes me quit remembering.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;Haikuo &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 14:45:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/replacing-text-causes-string-to-cut-off/m-p/139944#M37426</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-01-27T14:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: replacing text causes string to cut off</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/replacing-text-causes-string-to-cut-off/m-p/139945#M37427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hai.kou,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much.&amp;nbsp; I didn't think of adding the length statement to my code.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That fixed it.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 15:04:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/replacing-text-causes-string-to-cut-off/m-p/139945#M37427</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2015-01-27T15:04:17Z</dc:date>
    </item>
  </channel>
</rss>

