<?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: Split string into rows using delimeter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Split-string-into-rows-using-delimeter/m-p/225706#M267835</link>
    <description>&lt;P&gt;Well - turns out I should have just kept trying!! &amp;nbsp;Just solved it...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test (keep=Key&amp;nbsp;NewWidth&amp;nbsp;Number);&lt;/P&gt;&lt;P&gt;set a.datasetname;&lt;BR /&gt;count=count(width,',');&lt;BR /&gt;put count=;&lt;/P&gt;&lt;P&gt;do i=1 to (count+1);&lt;BR /&gt;NewWidth=scan(width,i,',');&lt;BR /&gt;&lt;SPAN&gt;Number=&lt;/SPAN&gt;i;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Sep 2015 20:31:49 GMT</pubDate>
    <dc:creator>HeidiChi</dc:creator>
    <dc:date>2015-09-15T20:31:49Z</dc:date>
    <item>
      <title>Split string into rows using delimeter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-string-into-rows-using-delimeter/m-p/225701#M267834</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset that is like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Key &amp;nbsp; Width&lt;/U&gt;&lt;/P&gt;&lt;P&gt;123 &amp;nbsp; 99,99&lt;/P&gt;&lt;P&gt;456 &amp;nbsp; 99&lt;/P&gt;&lt;P&gt;789 &amp;nbsp; 87,99,142&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I wish I had was the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Key &amp;nbsp; NewWidth &amp;nbsp; &amp;nbsp;Number&lt;/U&gt;&lt;/P&gt;&lt;P&gt;123 &amp;nbsp; 99 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;123 &amp;nbsp; 99 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;456 &amp;nbsp; 99&lt;SPAN&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;1&lt;/P&gt;&lt;P&gt;789 &amp;nbsp; 87&lt;SPAN&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;1&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;789 &amp;nbsp; 99 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;789 &amp;nbsp; 142&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have&amp;nbsp;searched a few of the messages and gotten some things to work&amp;nbsp;but they require the NewWidth to always be the same # of characters...which it can be 2 or 3 characters. &amp;nbsp;So far I have attempted using substr(), scan(), countc()...nothing has clicked.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Again, thanks for any pointers!!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 20:13:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-string-into-rows-using-delimeter/m-p/225701#M267834</guid>
      <dc:creator>HeidiChi</dc:creator>
      <dc:date>2015-09-15T20:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: Split string into rows using delimeter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-string-into-rows-using-delimeter/m-p/225706#M267835</link>
      <description>&lt;P&gt;Well - turns out I should have just kept trying!! &amp;nbsp;Just solved it...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test (keep=Key&amp;nbsp;NewWidth&amp;nbsp;Number);&lt;/P&gt;&lt;P&gt;set a.datasetname;&lt;BR /&gt;count=count(width,',');&lt;BR /&gt;put count=;&lt;/P&gt;&lt;P&gt;do i=1 to (count+1);&lt;BR /&gt;NewWidth=scan(width,i,',');&lt;BR /&gt;&lt;SPAN&gt;Number=&lt;/SPAN&gt;i;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 20:31:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-string-into-rows-using-delimeter/m-p/225706#M267835</guid>
      <dc:creator>HeidiChi</dc:creator>
      <dc:date>2015-09-15T20:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Split string into rows using delimeter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-string-into-rows-using-delimeter/m-p/225709#M267836</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   number=0;
   do i=1 by 1;
      newwidth=scan(width,i);
	  if not missing(newwidth) then do;
      number+1;
	  output;
	  end;
	  if missing(newwidth) then leave;
   end;
   drop i width;
run;
	  &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Sep 2015 20:39:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-string-into-rows-using-delimeter/m-p/225709#M267836</guid>
      <dc:creator>slchen</dc:creator>
      <dc:date>2015-09-15T20:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Split string into rows using delimeter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-string-into-rows-using-delimeter/m-p/225711#M267837</link>
      <description>&lt;P&gt;It is&amp;nbsp;not clear whether&amp;nbsp;newWidth should be character or numeric. Here is a way to get both:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
do number = 1 by 1;
    newWidth = scan(width, number, ",");
    if missing(newWidth) then leave;
    numWidth = input(newWidth, best.);
    output;
    end;
keep key newWidth number numWidth;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Sep 2015 20:43:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-string-into-rows-using-delimeter/m-p/225711#M267837</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-09-15T20:43:46Z</dc:date>
    </item>
  </channel>
</rss>

