BookmarkSubscribeRSS Feed
Mike_Davis
Fluorite | Level 6

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

5 REPLIES 5
PGStats
Opal | Level 21

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
Mike_Davis
Fluorite | Level 6

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

PGStats
Opal | Level 21

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
Ksharp
Super User

Did you try some option similar to proc import ?

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

Mike_Davis
Fluorite | Level 6

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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 786 views
  • 0 likes
  • 3 in conversation