Date: Tue, 29 Apr 1997 15:26:10 GMT
Reply-To: Max Reid <reid@SUN-VALLEY.PREVMED.ROCHESTER.EDU>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Max Reid <reid@SUN-VALLEY.PREVMED.ROCHESTER.EDU>
Organization: University of Rochester
Subject: Re: Reading excel files with DDE
In article <email@example.com>,
Pamela G Tucker <firstname.lastname@example.org> wrote:
>I do not know if this works with any operating
>system other than windows 3.1.
>Here is a way to take an excel data file
>and end up with a sas data file. First save
>the excel file (call it excel.txt) as a space
>delimited text file. Get out of excel. Go into
>Word, or some other text editor, and open (get)
>the file excel.txt from the excel directory.
>Edit the file so that it contains only data
>(no headers) in columns that are all separated
>by exactly one space. Each colum should line up
>nicely. That is, each value in a particular column
>should all take up the same number of spaces
>(you may have to add a zero, +, - ect).
>Save as a text file called edited.txt.
>The sas program below reads in tree variables.
>Var1 take up 2 space, Var2 takes up 3, and Var3 takes 5.
>If it does not work the first time try looking at the
>sas log or/and the edited text for field length problems.
>Hope this helps.
>filename raw 'c:\winword\edited.txt' ;
>data exceldat ;
> infile raw ;
> input Var1 1-2 Var2 4-6 Var3 8-12 ;
I thought the advantage of DDE was to read data directly without having to
export, edit, and import the data. Nevertheless, you could eliminate the
"edit" step in the above solution by using the FIRSTOBS=2 option on the
INFILE statement. With this option, the header names will not be read--only