<?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: Excel import in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Excel-import/m-p/7346#M80</link>
    <description>Hi:&lt;BR /&gt;
  I'm having trouble envisioning what your Excel sheet looks like. &lt;BR /&gt;
&lt;BR /&gt;
Option 1: 5 columns with variable names in row 1 and company and date on a row by themselves:&lt;BR /&gt;
[pre]&lt;BR /&gt;
     A      B       C    D    E&lt;BR /&gt;
1 Company   Date   var1 var2 var3 &lt;BR /&gt;
2  ABC     1/2/05 &lt;BR /&gt;
3                   2    q    1&lt;BR /&gt;
4                   3    d    2&lt;BR /&gt;
5                   4    e    4&lt;BR /&gt;
6  DEF     1/2/06&lt;BR /&gt;
7                   4    e    5&lt;BR /&gt;
8                   5    e    7&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Option 2: company name is only on row 1 of the group and var1-var3 have values on the company row:&lt;BR /&gt;
[pre]&lt;BR /&gt;
     A      B       C    D    E&lt;BR /&gt;
1 Company   Date   var1 var2 var3 &lt;BR /&gt;
2  ABC     1/2/05   2    q    1&lt;BR /&gt;
3                   3    d    2&lt;BR /&gt;
4                   4    e    4&lt;BR /&gt;
5  DEF     1/2/06   4    e    5&lt;BR /&gt;
6                   5    e    7&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Option 3: 3 columns where column A and Column B are being used differently on every row:&lt;BR /&gt;
[pre]&lt;BR /&gt;
    A     B     C &lt;BR /&gt;
1  ABC  1/2/05 &lt;BR /&gt;
2   2     q     1&lt;BR /&gt;
3   3     d     2&lt;BR /&gt;
4   4     e     4&lt;BR /&gt;
5  DEF  1/2/06&lt;BR /&gt;
6   4     e     5&lt;BR /&gt;
7   5     e     7&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
It doesn't make a LOT of difference, the first 2 options for how the data will be read in probably is going to take a data step program with a RETAIN statement. The 3rd option might require a bit more data manipulation in addition to a RETAIN statement.&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
    <pubDate>Mon, 10 Mar 2008 00:00:25 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2008-03-10T00:00:25Z</dc:date>
    <item>
      <title>Excel import</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Excel-import/m-p/7344#M78</link>
      <description>I have data sets in excel that I want to bring into SAS.  They are structured like this.&lt;BR /&gt;
&lt;BR /&gt;
Company            Date      var1   var2   var3   &lt;BR /&gt;
    ABC              1/2/05      &lt;BR /&gt;
                                        2       q     1&lt;BR /&gt;
                                        3       d     2&lt;BR /&gt;
                                        4       e     4&lt;BR /&gt;
   DEF                1/2/06&lt;BR /&gt;
                                        4       e     5&lt;BR /&gt;
                                        5       e     7&lt;BR /&gt;
&lt;BR /&gt;
The number of observations per company vary.   What I want to do is to spread the company and date information across the corresponding var information.</description>
      <pubDate>Sun, 09 Mar 2008 14:50:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Excel-import/m-p/7344#M78</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-03-09T14:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Excel import</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Excel-import/m-p/7345#M79</link>
      <description>sounds like a minor task for a data step.&lt;BR /&gt;
&lt;BR /&gt;
Just read a line and hold it; identify it's type and read relevant variables; if it is a company heading "RETAIN" those values; if it is a regular set of variables, "OUTPUT" a data row.&lt;BR /&gt;
&lt;BR /&gt;
You may want these data in separate tables. The DATA statement allows more than one output data set to be defined. The OUTPUT statement allows you to nominate the table into which the row should be written.&lt;BR /&gt;
&lt;BR /&gt;
There may even be an example in the manual. Search for "reading hierarchical files". I think that is the terminology for your data structure.&lt;BR /&gt;
&lt;BR /&gt;
Good Luck&lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
      <pubDate>Sun, 09 Mar 2008 22:38:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Excel-import/m-p/7345#M79</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2008-03-09T22:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Excel import</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Excel-import/m-p/7346#M80</link>
      <description>Hi:&lt;BR /&gt;
  I'm having trouble envisioning what your Excel sheet looks like. &lt;BR /&gt;
&lt;BR /&gt;
Option 1: 5 columns with variable names in row 1 and company and date on a row by themselves:&lt;BR /&gt;
[pre]&lt;BR /&gt;
     A      B       C    D    E&lt;BR /&gt;
1 Company   Date   var1 var2 var3 &lt;BR /&gt;
2  ABC     1/2/05 &lt;BR /&gt;
3                   2    q    1&lt;BR /&gt;
4                   3    d    2&lt;BR /&gt;
5                   4    e    4&lt;BR /&gt;
6  DEF     1/2/06&lt;BR /&gt;
7                   4    e    5&lt;BR /&gt;
8                   5    e    7&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Option 2: company name is only on row 1 of the group and var1-var3 have values on the company row:&lt;BR /&gt;
[pre]&lt;BR /&gt;
     A      B       C    D    E&lt;BR /&gt;
1 Company   Date   var1 var2 var3 &lt;BR /&gt;
2  ABC     1/2/05   2    q    1&lt;BR /&gt;
3                   3    d    2&lt;BR /&gt;
4                   4    e    4&lt;BR /&gt;
5  DEF     1/2/06   4    e    5&lt;BR /&gt;
6                   5    e    7&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Option 3: 3 columns where column A and Column B are being used differently on every row:&lt;BR /&gt;
[pre]&lt;BR /&gt;
    A     B     C &lt;BR /&gt;
1  ABC  1/2/05 &lt;BR /&gt;
2   2     q     1&lt;BR /&gt;
3   3     d     2&lt;BR /&gt;
4   4     e     4&lt;BR /&gt;
5  DEF  1/2/06&lt;BR /&gt;
6   4     e     5&lt;BR /&gt;
7   5     e     7&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
It doesn't make a LOT of difference, the first 2 options for how the data will be read in probably is going to take a data step program with a RETAIN statement. The 3rd option might require a bit more data manipulation in addition to a RETAIN statement.&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 10 Mar 2008 00:00:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Excel-import/m-p/7346#M80</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-03-10T00:00:25Z</dc:date>
    </item>
  </channel>
</rss>

