<?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 Excel Spreadsheet in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Excel-Spreadsheet/m-p/51775#M10889</link>
    <description>Hi All,&lt;BR /&gt;
&lt;BR /&gt;
Need some help here. Will probably be fairly basic for most of you. I have 50 columns of data that are headed by an account number. Under each of the 50 account numbers I have 720 rows of data. What I need to do is take each of the 50 columns of data and put them into one column, minus the account numbers. The account numbers would then be in the next column over. The account number needs to be listed next to each row of data.  Example :  &lt;BR /&gt;
&lt;BR /&gt;
Column A      Column B&lt;BR /&gt;
data                account #&lt;BR /&gt;
data                account #&lt;BR /&gt;
data                account #&lt;BR /&gt;
data                account #&lt;BR /&gt;
data                account #&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Once the 720 rows of the first account number are in column A, the next 720 from the next account # need to move to column A and start writing that account # into column B. Any ideas?&lt;BR /&gt;
&lt;BR /&gt;
Thanks very much in advance. &lt;BR /&gt;
&lt;BR /&gt;
Aaron</description>
    <pubDate>Tue, 07 Jul 2009 13:08:59 GMT</pubDate>
    <dc:creator>Aar684</dc:creator>
    <dc:date>2009-07-07T13:08:59Z</dc:date>
    <item>
      <title>Excel Spreadsheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-Spreadsheet/m-p/51775#M10889</link>
      <description>Hi All,&lt;BR /&gt;
&lt;BR /&gt;
Need some help here. Will probably be fairly basic for most of you. I have 50 columns of data that are headed by an account number. Under each of the 50 account numbers I have 720 rows of data. What I need to do is take each of the 50 columns of data and put them into one column, minus the account numbers. The account numbers would then be in the next column over. The account number needs to be listed next to each row of data.  Example :  &lt;BR /&gt;
&lt;BR /&gt;
Column A      Column B&lt;BR /&gt;
data                account #&lt;BR /&gt;
data                account #&lt;BR /&gt;
data                account #&lt;BR /&gt;
data                account #&lt;BR /&gt;
data                account #&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Once the 720 rows of the first account number are in column A, the next 720 from the next account # need to move to column A and start writing that account # into column B. Any ideas?&lt;BR /&gt;
&lt;BR /&gt;
Thanks very much in advance. &lt;BR /&gt;
&lt;BR /&gt;
Aaron</description>
      <pubDate>Tue, 07 Jul 2009 13:08:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-Spreadsheet/m-p/51775#M10889</guid>
      <dc:creator>Aar684</dc:creator>
      <dc:date>2009-07-07T13:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Excel Spreadsheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-Spreadsheet/m-p/51776#M10890</link>
      <description>Hi:&lt;BR /&gt;
  I'm having a hard time envisioning the "before" and "after". This is what I imagine. You have data that looks like this (sort of) but with 50 accts and 720 rows. I made some fake data with only 5 accounts and 5 rows. You said your columns were "headed" by an account number. I took that to mean that the column NAMES were acct1, acct2, acct3, etc.:&lt;BR /&gt;
[pre]&lt;BR /&gt;
acct1  acct2  acct3   acct4   acct5&lt;BR /&gt;
 101    1101   11101  111101 1111101&lt;BR /&gt;
 102    1102   11102  111102 1111102&lt;BR /&gt;
 103    1103   11103  111103 1111103&lt;BR /&gt;
 104    1104   11104  111104 1111104&lt;BR /&gt;
 105    1105   11105  111105 1111105&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                         &lt;BR /&gt;
And you want this output form:&lt;BR /&gt;
[pre]&lt;BR /&gt;
column_A    column_B&lt;BR /&gt;
     101     acct1&lt;BR /&gt;
     102     acct1&lt;BR /&gt;
     103     acct1&lt;BR /&gt;
     104     acct1&lt;BR /&gt;
     105     acct1&lt;BR /&gt;
    1101     acct2&lt;BR /&gt;
    1102     acct2&lt;BR /&gt;
    1103     acct2&lt;BR /&gt;
    1104     acct2&lt;BR /&gt;
    1105     acct2&lt;BR /&gt;
   11101     acct3&lt;BR /&gt;
   11102     acct3&lt;BR /&gt;
   11103     acct3&lt;BR /&gt;
   11104     acct3&lt;BR /&gt;
   11105     acct3&lt;BR /&gt;
  111101     acct4&lt;BR /&gt;
  111102     acct4&lt;BR /&gt;
  111103     acct4&lt;BR /&gt;
  111104     acct4&lt;BR /&gt;
  111105     acct4&lt;BR /&gt;
 1111101     acct5&lt;BR /&gt;
 1111102     acct5&lt;BR /&gt;
 1111103     acct5&lt;BR /&gt;
 1111104     acct5&lt;BR /&gt;
 1111105     acct5&lt;BR /&gt;
[/pre]&lt;BR /&gt;
               &lt;BR /&gt;
And you want the output to be in Excel. This last part is the easiest. You can either create a final dataset in the structure you want and use proc export or the Excel Libname engine to get the data into Excel. Or, you can use ODS CSV, ODS HTML or ODS TAGSETS.EXCELXP to get a report (probably PROC PRINT) output into a type of file that Excel can open.&lt;BR /&gt;
&lt;BR /&gt;
As for how to transform your data, if I have correctly described the transformation, you have several choices:&lt;BR /&gt;
1) investigate PROC TRANSPOSE&lt;BR /&gt;
2) investigate the use of arrays in a data step program to transform your data from "wide" data structure to "narrow" data structure&lt;BR /&gt;
3) use PROC SQL (probably with multiple passes) to create the final dataset&lt;BR /&gt;
 &lt;BR /&gt;
There have been quite a few previous forum postings on all 3 of these methods for transforming data.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 07 Jul 2009 16:11:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-Spreadsheet/m-p/51776#M10890</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-07-07T16:11:21Z</dc:date>
    </item>
  </channel>
</rss>

