<?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 insert brackets into variable output in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/insert-brackets-into-variable-output/m-p/652126#M195748</link>
    <description>&lt;P&gt;I have a variable called 'Contact Name'. In this variable there are staff names and ID.&lt;/P&gt;&lt;P&gt;Contact name will have values&amp;nbsp;of staff members name (both first name and surname, but sometimes just first name and sometimes no name)&amp;nbsp; and&amp;nbsp;ID,&amp;nbsp;3 character and 3 numeric eg&amp;nbsp;&lt;/P&gt;&lt;P&gt;John Smith ABC123&lt;/P&gt;&lt;P&gt;Peter DEF345&lt;/P&gt;&lt;P&gt;Harry (GHI678)&lt;/P&gt;&lt;P&gt;Harry GHI678&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'd like to do, is that when the ID does not have brackets around them, I'd like to have brackets around them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Current State: Harry GHI678&lt;/P&gt;&lt;P&gt;Desired outcome: Harry (GHI678)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Haydn&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jun 2020 00:05:12 GMT</pubDate>
    <dc:creator>Haydn</dc:creator>
    <dc:date>2020-06-01T00:05:12Z</dc:date>
    <item>
      <title>insert brackets into variable output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/insert-brackets-into-variable-output/m-p/652126#M195748</link>
      <description>&lt;P&gt;I have a variable called 'Contact Name'. In this variable there are staff names and ID.&lt;/P&gt;&lt;P&gt;Contact name will have values&amp;nbsp;of staff members name (both first name and surname, but sometimes just first name and sometimes no name)&amp;nbsp; and&amp;nbsp;ID,&amp;nbsp;3 character and 3 numeric eg&amp;nbsp;&lt;/P&gt;&lt;P&gt;John Smith ABC123&lt;/P&gt;&lt;P&gt;Peter DEF345&lt;/P&gt;&lt;P&gt;Harry (GHI678)&lt;/P&gt;&lt;P&gt;Harry GHI678&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'd like to do, is that when the ID does not have brackets around them, I'd like to have brackets around them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Current State: Harry GHI678&lt;/P&gt;&lt;P&gt;Desired outcome: Harry (GHI678)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Haydn&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2020 00:05:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/insert-brackets-into-variable-output/m-p/652126#M195748</guid>
      <dc:creator>Haydn</dc:creator>
      <dc:date>2020-06-01T00:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: insert brackets into variable output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/insert-brackets-into-variable-output/m-p/652127#M195749</link>
      <description>&lt;P&gt;Please try the perl regular expression as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input name&amp;amp;$50.;
cards;
John Smith ABC123
Peter DEF345
Harry (GHI678)
Harry GHI678
;

data want;
set have;
new=prxchange('s/(.*)(\w{3}\d{3})$/$1($2)/oi',-1,strip(name));
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Jun 2020 00:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/insert-brackets-into-variable-output/m-p/652127#M195749</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2020-06-01T00:22:23Z</dc:date>
    </item>
  </channel>
</rss>

