<?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 INSERT DELIMITER IN A SRING in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-INSERT-DELIMITER-IN-A-SRING/m-p/739801#M230956</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Look here:&lt;/P&gt;
&lt;P&gt;Inserting a substring into a SAS string&lt;BR /&gt;By Leonid Batkhan on SAS Users February 15, 2021&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sgf/2021/02/15/inserting-a-substring-into-a-sas-string/" target="_blank"&gt;https://blogs.sas.com/content/sgf/2021/02/15/inserting-a-substring-into-a-sas-string/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Have a nice weekend,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 May 2021 15:33:46 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2021-05-07T15:33:46Z</dc:date>
    <item>
      <title>HOW TO INSERT DELIMITER IN A SRING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-INSERT-DELIMITER-IN-A-SRING/m-p/739798#M230955</link>
      <description>&lt;P&gt;I'm a learner of SAS interested in pursuing the career towards it so please help me. As i mentioned above can somebody please explain how to insert delimiter in a string like example &lt;A href="mailto:asdf@gmail.com" target="_blank"&gt;asdf@gmail.com&lt;/A&gt;&amp;nbsp; to&amp;nbsp; &amp;nbsp;&lt;A href="mailto:asdf-@gmail.com" target="_blank"&gt;asdf-@gmail.com&lt;/A&gt;&amp;nbsp;by not breaking it into three variables like a=asdf b=@ c=gmail.com.&lt;/P&gt;&lt;P&gt;this is my question please help me im stuck&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 15:09:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-INSERT-DELIMITER-IN-A-SRING/m-p/739798#M230955</guid>
      <dc:creator>saidatta</dc:creator>
      <dc:date>2021-05-07T15:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO INSERT DELIMITER IN A SRING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-INSERT-DELIMITER-IN-A-SRING/m-p/739801#M230956</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Look here:&lt;/P&gt;
&lt;P&gt;Inserting a substring into a SAS string&lt;BR /&gt;By Leonid Batkhan on SAS Users February 15, 2021&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sgf/2021/02/15/inserting-a-substring-into-a-sas-string/" target="_blank"&gt;https://blogs.sas.com/content/sgf/2021/02/15/inserting-a-substring-into-a-sas-string/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Have a nice weekend,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 15:33:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-INSERT-DELIMITER-IN-A-SRING/m-p/739801#M230956</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-05-07T15:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO INSERT DELIMITER IN A SRING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-INSERT-DELIMITER-IN-A-SRING/m-p/739802#M230957</link>
      <description>&lt;P&gt;For that simple example you can with do a replace:&lt;/P&gt;
&lt;P&gt;If you know there are two and only two "words" separated by&amp;nbsp;@ you can use scan() to parse it and catx() to build it back.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length have want1-want2 $100;
  have='asdf@gmail.com';
  want1=tranwrd(have,'@','-@');
  want2=catx('-@',scan(have,1,'@'),scan(have,2,'@'));
run;

proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs         have              want1              want2

 1     asdf@gmail.com    asdf-@gmail.com    asdf-@gmail.com

&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 May 2021 15:39:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-INSERT-DELIMITER-IN-A-SRING/m-p/739802#M230957</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-07T15:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO INSERT DELIMITER IN A SRING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-INSERT-DELIMITER-IN-A-SRING/m-p/739803#M230958</link>
      <description>&lt;P&gt;One of the things to consider when "inserting" into any string variable is the length of the variable. SAS variables when created will have a defined length. If the current value uses all of the available character positions then "inserting" means that the characters on the end of the value will be truncated because there is no place to store them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, your problem description should include:&lt;/P&gt;
&lt;P&gt;The length of the variable (find this with Proc Contents if you don't know another way)&lt;/P&gt;
&lt;P&gt;Determine the current longest value(s) held in the variable.&lt;/P&gt;
&lt;P&gt;See if the resulting inserted value will still fit.&lt;/P&gt;
&lt;P&gt;If not, you will need to do something with the length prior.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is one way where the length is long enough to hold the inserted character&lt;/P&gt;
&lt;PRE&gt;data example;
   length string $ 50;
   string="asdf@gmail.com";
   string = transtrn(string,'@','_@');
run;&lt;/PRE&gt;
&lt;P&gt;Caution: the Transtrn function will replace all occurrences of the target string, the '@'.&lt;/P&gt;
&lt;P&gt;Also, you will not want to run the same code against the same data set repeatedly as you will keep adding _ characters.&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 15:41:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-INSERT-DELIMITER-IN-A-SRING/m-p/739803#M230958</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-07T15:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO INSERT DELIMITER IN A SRING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-INSERT-DELIMITER-IN-A-SRING/m-p/739805#M230959</link>
      <description>&lt;P&gt;TRANWRD()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0pgemqcslm9uen1tvr5gcrusgrw.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0pgemqcslm9uen1tvr5gcrusgrw.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 15:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-INSERT-DELIMITER-IN-A-SRING/m-p/739805#M230959</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-05-07T15:42:31Z</dc:date>
    </item>
  </channel>
</rss>

