Help using Base SAS procedures

Problem of use libname to associate excel

Reply
Regular Contributor
Posts: 222

Problem of use libname to associate excel

Hello everyone,

I have a Excel file named ALL, and sheet named SHEET1.

Not like using proc import ,,,when I use libname to connect excel file to SAS such as:

libname xl Excel "C:\Temp\ALL.xls"; I can get a SAS dataset xl.SHEET1.

BUT if the first 8 obs of a column is empty, then this column will be set to length $1. and all the numeric value of this column will be set to empty.

So if I still want to use libname I have to set a value in the first 8 obs.

Please give me some suggestion on it!

Thanks!

Mike

Respected Advisor
Posts: 4,745

Re: Problem of use libname to associate excel

This is a bit messy, but fortunately, you will have to do this only once. The problem lies with the number of lines that Excel scans to determine the properties of columns. You must change the TypeGuessRows entry in Windows registry. This is described on page 36 of the document :

http://support.sas.com/documentation/cdl/en/acpcref/63184/PDF/default/acpcref.pdf

PG

PG
Regular Contributor
Posts: 222

Re: Problem of use libname to associate excel

Thanks PG,

but I don't have the permit to change the computer's setting,,,,,,so what I can do only is add an extra row on the top  to define the columns' properties?

Thanks

Mike

Respected Advisor
Posts: 4,745

Re: Problem of use libname to associate excel

Bt default, Excel scans only the first 8 lines of a table to determine the column properties. So, yes, putting your longest possible string within the first 8 lines will do the trick.  - PG

PG
Super User
Posts: 9,766

Re: Problem of use libname to associate excel

Did you try some option similar to proc import ?

libname x excel 'c:\xx.xls' scantext=yes mixed=yes;

Regular Contributor
Posts: 222

Re: Problem of use libname to associate excel

Thanks Ksharp,

I had tried these options before

I am sure this is not a new problem, if you could find an option like that would be fantastic!

Thanks

Mike

Ask a Question
Discussion stats
  • 5 replies
  • 169 views
  • 0 likes
  • 3 in conversation