<?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 TRANWRD SUBSTR in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/TRANWRD-SUBSTR/m-p/176530#M264722</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello, I want to replace a substr in a text to some else, somehow the following does not work. Any ideas? If I assign the string values to the temp_str and new_str, the F1 is updated as intended. Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;DATA TEST;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;F1 = &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;"9999,'ABC', 110,2,&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00,&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00, 14, 17,1.02454,&amp;nbsp; 27.9937,1"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;CALL &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;SCAN(F1,&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;5&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;,POS,LEN,&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;','&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;TEMP_STR = SUBSTR(F1,&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;,POS-&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;NEW_STR = CAT(SUBSTR(F1,1,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;POS-&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;3&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;'1'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;F1 = TRANWRD(F1,TEMP_STR,NEW_STR);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;RUN; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Oct 2014 16:10:35 GMT</pubDate>
    <dc:creator>YW_CA</dc:creator>
    <dc:date>2014-10-08T16:10:35Z</dc:date>
    <item>
      <title>TRANWRD SUBSTR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TRANWRD-SUBSTR/m-p/176530#M264722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello, I want to replace a substr in a text to some else, somehow the following does not work. Any ideas? If I assign the string values to the temp_str and new_str, the F1 is updated as intended. Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;DATA TEST;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;F1 = &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;"9999,'ABC', 110,2,&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00,&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00, 14, 17,1.02454,&amp;nbsp; 27.9937,1"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;CALL &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;SCAN(F1,&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;5&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;,POS,LEN,&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;','&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;TEMP_STR = SUBSTR(F1,&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;,POS-&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;NEW_STR = CAT(SUBSTR(F1,1,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;POS-&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;3&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;'1'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;F1 = TRANWRD(F1,TEMP_STR,NEW_STR);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;RUN; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2014 16:10:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TRANWRD-SUBSTR/m-p/176530#M264722</guid>
      <dc:creator>YW_CA</dc:creator>
      <dc:date>2014-10-08T16:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: TRANWRD SUBSTR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TRANWRD-SUBSTR/m-p/176531#M264723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is a good idea describe the intended output instead of just "doesn't work".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're not getting the match you expect because both TEMP_STR and NEW_STR are 200 characters long and all of them are used in the comparison.&lt;/P&gt;&lt;P&gt;You may want:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRANWRD(F1,strip(TEMP_STR),strip(NEW_STR))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2014 16:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TRANWRD-SUBSTR/m-p/176531#M264723</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-10-08T16:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: TRANWRD SUBSTR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TRANWRD-SUBSTR/m-p/176532#M264724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the STRIP worked. so by default, the substr is 200 characters long?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2014 17:44:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TRANWRD-SUBSTR/m-p/176532#M264724</guid>
      <dc:creator>YW_CA</dc:creator>
      <dc:date>2014-10-08T17:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: TRANWRD SUBSTR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TRANWRD-SUBSTR/m-p/176533#M264725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The result of CAT, and many other string functions, is 200 unless you define the variable first. But even with a defined length you would likely have the comparison for some values with the trailing blanks. So it is a good idea to STRIP values. Though you need other approaches if you want leading blanks compared...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2014 19:37:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TRANWRD-SUBSTR/m-p/176533#M264725</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-10-08T19:37:03Z</dc:date>
    </item>
  </channel>
</rss>

