<?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 chop a long Excel cell string in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-chop-a-long-Excel-cell-string/m-p/79453#M22875</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you ultimately want to bring these names back in Excel, the simplest thing to do is to use the Data-Conversion operation with spaces as delimiters directly in Excel. You'll get your 241 variable names in the first row which you may then paste-transpose to get a single column.&lt;/P&gt;&lt;P&gt;If you insist on doing this operation in SAS, then look at the SCAN function. As in :&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;do i=1 by 1 until(missing(name));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = scan(names, i);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not missing(name) then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;drop names;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 10 Jun 2012 00:32:47 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2012-06-10T00:32:47Z</dc:date>
    <item>
      <title>How to chop a long Excel cell string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-chop-a-long-Excel-cell-string/m-p/79452#M22874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Hi Colleagues,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I was given the names of over 200 variables just as a single Excel string (&lt;SPAN style="color: #ff0000;"&gt;attached&lt;/SPAN&gt;).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I want to separate individual variable names as: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;AA_VAR1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;AA_VAR2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;AA_VAR3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;AA_VAR4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;I separated them using text function of Excel like below but it took me the time almost same as doing manually.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;=LEFT(B2,7)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;=MID(B2,9,7)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;=MID(B2,17,7)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I wonder if there is an automated way of doing using SAS?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Any help is appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Mirisage&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Jun 2012 23:43:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-chop-a-long-Excel-cell-string/m-p/79452#M22874</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2012-06-09T23:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop a long Excel cell string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-chop-a-long-Excel-cell-string/m-p/79453#M22875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you ultimately want to bring these names back in Excel, the simplest thing to do is to use the Data-Conversion operation with spaces as delimiters directly in Excel. You'll get your 241 variable names in the first row which you may then paste-transpose to get a single column.&lt;/P&gt;&lt;P&gt;If you insist on doing this operation in SAS, then look at the SCAN function. As in :&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;do i=1 by 1 until(missing(name));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = scan(names, i);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not missing(name) then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;drop names;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Jun 2012 00:32:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-chop-a-long-Excel-cell-string/m-p/79453#M22875</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-06-10T00:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop a long Excel cell string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-chop-a-long-Excel-cell-string/m-p/79454#M22876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi PG,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have just taken a piece of that string to try your SAS code. I cannot figure out why it doesn't work. Time permitting, I wonder if you could help again. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input names $250.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;AA_VAR1 AA_VAR2 AA_VAR3 AA_VAR4 AA_VAR5 AA_VAR6 AA_VAR7 AA_VAR8 AA_VAR11 AA_VAR12;&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;do i=1 by 1 until(missing(name));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = scan(names, i);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not missing(name) then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;drop names;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mirisage&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Jun 2012 12:23:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-chop-a-long-Excel-cell-string/m-p/79454#M22876</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2012-06-10T12:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop a long Excel cell string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-chop-a-long-Excel-cell-string/m-p/79455#M22877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There were minor problems, corrected now:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;length names $250;&lt;/P&gt;&lt;P&gt;input names &amp;amp; ;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;AA_VAR1 AA_VAR2 AA_VAR3 AA_VAR4 AA_VAR5 AA_VAR6 AA_VAR7 AA_VAR8 AA_VAR11 AA_VAR12&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;length name $8;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;do i=1 by 1 until(missing(name));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = scan(names, i);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not missing(name) then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;drop names;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Jun 2012 12:48:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-chop-a-long-Excel-cell-string/m-p/79455#M22877</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-06-10T12:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to chop a long Excel cell string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-chop-a-long-Excel-cell-string/m-p/79456#M22878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi PG,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A big thank for you. This is great! Worked well! Now I came to know about scan function too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mirisage&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2012 12:57:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-chop-a-long-Excel-cell-string/m-p/79456#M22878</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2012-06-11T12:57:15Z</dc:date>
    </item>
  </channel>
</rss>

