Page 1 of 1

unable to open excel data

Posted: Sat Aug 01, 2009 10:19 am
by ef08kp
this may sound very elementary but i have been trying to open my excel data file but only to failure i am using the code provided in enders manual. The code that i use is as follows
cal 1973 1 12
all 2009:5
open data c:\eme.xls
data(org=obs,format=xls)

Re: unable to open excel data

Posted: Sun Aug 02, 2009 6:27 am
by TomDoan
You'll have to explain what "failure" means. Your program is correct for reading an Excel file (any format earlier than Excel 2007) with column headers in the first row with numbers under them; and nothing else. If your data file has additional information (long descriptions of the data at the top, for instance), you'll need to use the SKIP option to skip over those lines. If you have dates on the file, they need to be in the first column and either be date-formatted numbers, or one of several string formats. Without knowing what error messages you're getting, it's really hard to offer much help.

Re: unable to open excel data

Posted: Sun Aug 02, 2009 1:33 pm
by ef08kp
what actually is happening is that whenever i am giving the code a browsing window opens showing all files that are in excel format,and quite annoyingly no excel files on my computer are there. However, i went through chris brook's book which contained a section on data import it mentioned that data should be in the format as you mentioned and shouldn't contain any special characters which may not allow the software to read the data. I rectified that also my data has description in row format, dates in mm/dd/yy format and data again in columns. Also row headings of data are only one word no verbose sentences.

Re: unable to open excel data

Posted: Sun Aug 02, 2009 5:29 pm
by ef08kp
I also would also like to add that enders.zip which contains money_dem as demonstration Is also being seen as a text file by RATS 7.1.

Re: unable to open excel data

Posted: Sun Aug 02, 2009 9:36 pm
by TomDoan
I think you're misunderstanding the dialog box. Windows filters files by their extensions. Since there is no standard extension for text files (.dat, .txt, .prn, .csv are just a few), RATS uses *.* (which matches all files) as the extension mask. That doesn't mean that those files are actually text files. If you change the file type selector to "Excel Files(*.xls)" it will show only the Excel files and will process the files as Excel files.

Re: unable to open excel data

Posted: Mon Aug 03, 2009 12:56 pm
by moderator
Further to Tom Doan's point, if you are supplying an OPEN DATA instruction before your DATA instruction, you shouldn't see any dialog box at all *if* you have specified the path and filename properly on the OPEN DATA instruction. RATS only displays the dialog asking you to locate the file if it can't find the file given the path and filename you provided.

So, it sounds like you either had the filename wrong, or your files are somewhere other than in the root directory of your C:\ driver.

You may want to use Windows Explorer, the Windows "Search" feature, or something similar to identify where your files are actually stored.

Also, note that if the path or filename includes spaces, you need to enclose the whole path in quotes. For example:

open data "C:\My Documents\sample.xls"

needs the quotes, because of the space after the word "My".