<?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: splitting a variable into several depending on parenthesis in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/splitting-a-variable-into-several-depending-on-parenthesis/m-p/209650#M4851</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use scan with ( as delimiter.&lt;/P&gt;&lt;P&gt;Compress ) from the results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 May 2015 15:53:32 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2015-05-05T15:53:32Z</dc:date>
    <item>
      <title>splitting a variable into several depending on parenthesis</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/splitting-a-variable-into-several-depending-on-parenthesis/m-p/209649#M4850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;suppose I have the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="99" style="border: 1px solid rgb(0, 0, 0); width: 271px; height: 82px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;name&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;srjg5483h (djfhtbv&amp;nbsp; fjfj ) (fhfh 183 f)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;fjj8 (f)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;fkk&amp;nbsp;&amp;nbsp; 999999&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like is to create new columns for the text within the parentheses (whenever present) :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="99" style="border: 1px solid rgb(0, 0, 0); width: 572px; height: 73px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;name&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;info&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;code&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;srjg5483h (djfhtbv&amp;nbsp; fjfj ) (fhfh 183 f)&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;djfhtbv&amp;nbsp; fjfj&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;fhfh 183 f&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;fjj8 (f)&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;f&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;fkk&amp;nbsp;&amp;nbsp; 999999&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2015 15:40:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/splitting-a-variable-into-several-depending-on-parenthesis/m-p/209649#M4850</guid>
      <dc:creator>ilikesas</dc:creator>
      <dc:date>2015-05-05T15:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: splitting a variable into several depending on parenthesis</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/splitting-a-variable-into-several-depending-on-parenthesis/m-p/209650#M4851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use scan with ( as delimiter.&lt;/P&gt;&lt;P&gt;Compress ) from the results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2015 15:53:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/splitting-a-variable-into-several-depending-on-parenthesis/m-p/209650#M4851</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-05-05T15:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: splitting a variable into several depending on parenthesis</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/splitting-a-variable-into-several-depending-on-parenthesis/m-p/209651#M4852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This will give you your desired output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile cards dsd;&lt;/P&gt;&lt;P&gt;length name $50.;&lt;/P&gt;&lt;P&gt;input name $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;srjg5483h (djfhtbv&amp;nbsp; fjfj ) (fhfh 183 f)&lt;/P&gt;&lt;P&gt;fjj8 (f)&lt;/P&gt;&lt;P&gt;fkk&amp;nbsp;&amp;nbsp; 999999&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;info = scan(name,2,'(,)');&lt;/P&gt;&lt;P&gt;code = scan(name,4,'(,)');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2015 15:59:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/splitting-a-variable-into-several-depending-on-parenthesis/m-p/209651#M4852</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-05-05T15:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: splitting a variable into several depending on parenthesis</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/splitting-a-variable-into-several-depending-on-parenthesis/m-p/209652#M4853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;


data have;
infile cards dsd;
length name $50.;
input name $;
cards;
srjg5483h (djfhtbv&amp;nbsp; fjfj ) (fhfh 183 f)
fjj8 (f)
fkk&amp;nbsp;&amp;nbsp; 999999
;
run;

proc sql;
select max(countc(name,'()'))/2 into : n separated by ' ' from have;
quit;
data want;
 set have;
 array x{*} $ 100 v1-v&amp;amp;n;
 do i=1 to &amp;amp;n ;
&amp;nbsp; x{i}=scan(name,i*2,'()','m');
 end;
 drop i;
 run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2015 13:46:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/splitting-a-variable-into-several-depending-on-parenthesis/m-p/209652#M4853</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-05-06T13:46:43Z</dc:date>
    </item>
  </channel>
</rss>

