<?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: HOW to replace the text  of a variable with unfixed value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/HOW-to-replace-the-text-of-a-variable-with-unfixed-value/m-p/577967#M163858</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;: Dunno. Perhaps the OP, though having given us a sample not in SBCS, has to deal with SBCS only or has somehow adapted the idea to D/MBCS.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jul 2019 07:16:59 GMT</pubDate>
    <dc:creator>hashman</dc:creator>
    <dc:date>2019-07-31T07:16:59Z</dc:date>
    <item>
      <title>HOW to replace the text  of a variable with unfixed value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-to-replace-the-text-of-a-variable-with-unfixed-value/m-p/577942#M163840</link>
      <description>&lt;P&gt;hi，all.&lt;/P&gt;&lt;P&gt;I have a&amp;nbsp; variable "InstanceName" ,I want to replace the text “n” of the "InstanceName" with the text “n=06”.&lt;/P&gt;&lt;P&gt;For example ,before:&amp;nbsp; "第n周期第21±2天(队列一) (n=06)"&amp;nbsp; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;after:&amp;nbsp; &amp;nbsp;"第06周期第21±2天(队列一) ".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variable "InstanceName" as follows;&lt;/P&gt;&lt;P&gt;THANKS a lot .&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="截图20190731112140.png" style="width: 324px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31429iAA70E0B6544BF3EC/image-size/large?v=v2&amp;amp;px=999" role="button" title="截图20190731112140.png" alt="截图20190731112140.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 03:25:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-to-replace-the-text-of-a-variable-with-unfixed-value/m-p/577942#M163840</guid>
      <dc:creator>HannaZhang</dc:creator>
      <dc:date>2019-07-31T03:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: HOW to replace the text  of a variable with unfixed value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-to-replace-the-text-of-a-variable-with-unfixed-value/m-p/577944#M163842</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/275211"&gt;@HannaZhang&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;You can try the expression below, though there're many other (likely neater) ways to do it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; InstanceName = tranwrd (substr (InstanceName, 1,  find (InstanceName, " (n="))   
                        ,"n"                                                      
                        ,substr (InstanceName, 4 + find (InstanceName, " (n="), 2)
                         ) ;                                                      
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 04:45:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-to-replace-the-text-of-a-variable-with-unfixed-value/m-p/577944#M163842</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2019-07-31T04:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: HOW to replace the text  of a variable with unfixed value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-to-replace-the-text-of-a-variable-with-unfixed-value/m-p/577947#M163845</link>
      <description>&lt;P&gt;I can only test in SBCS, but this should be close:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t; 
  INSTANCENAME ='AAnBBCC (n=06)  ';
  NUMBER       =kscan(INSTANCENAME,-1,' )=');
  INSTANCENAME =kupdate(INSTANCENAME,kindexc(INSTANCENAME,'n'),1,ktrim(NUMBER));
  INSTANCENAME =kscan(INSTANCENAME,1,' ');
  put INSTANCENAME=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;INSTANCENAME=AA06BBCC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 04:59:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-to-replace-the-text-of-a-variable-with-unfixed-value/m-p/577947#M163845</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-07-31T04:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: HOW to replace the text  of a variable with unfixed value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-to-replace-the-text-of-a-variable-with-unfixed-value/m-p/577959#M163852</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/21262"&gt;@hashman&lt;/a&gt; How come single-byte functions work here?&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 06:43:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-to-replace-the-text-of-a-variable-with-unfixed-value/m-p/577959#M163852</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-07-31T06:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: HOW to replace the text  of a variable with unfixed value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-to-replace-the-text-of-a-variable-with-unfixed-value/m-p/577967#M163858</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;: Dunno. Perhaps the OP, though having given us a sample not in SBCS, has to deal with SBCS only or has somehow adapted the idea to D/MBCS.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 07:16:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-to-replace-the-text-of-a-variable-with-unfixed-value/m-p/577967#M163858</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2019-07-31T07:16:59Z</dc:date>
    </item>
  </channel>
</rss>

