BookmarkSubscribeRSS Feed
Dreamer
Obsidian | Level 7

Hi,

It looks like PROC IMPORT's option MIXED = YES doesn't work with Excel 2007. It works perfectly with Excel 2003.

Is there any work around?

I don't want to assign format in data step for 100 variables. 

8 REPLIES 8
ballardw
Super User

Define "doesn't work". Do you get error messages? Unexpected result?

If you show the complete syntax and post an example of the data it doesn't work for you may get a more helpful response, otherwise you'll be getting guesses.

Dreamer
Obsidian | Level 7

It gives error!!

Code:

PROC IMPORT OUT=Work.Temp

DATAFILE="<<Workbook Location>>"

DBMS=XLSX REPLACE;

MIXED=YES;

SHEET=SHEET1;

RUN;

Log:

26     MIXED=YES;
       _____
       180

ERROR 180-322: Statement is not valid or it is used out of proper order.

Dreamer
Obsidian | Level 7

It works fine if I remove MIXED = YES option. But then SAS doesn't read the correct values.

art297
Opal | Level 21

According to the documentation DBMS=XLSX only accepts getnames, range and sheets. Have you tried either DBMS=Excel or DBMS=Excelcs?

Dreamer
Obsidian | Level 7

Hi ,

DBMS=EXCEL option is for Excel 2003 and it works fine if I save my workbooks in that format.

But my excels are in 2007 format.

I have already tried DBMS=Excelcs with no luck!!

art297
Opal | Level 21

What version of SAS are you using?

ballardw
Super User

MIXED= only works with DBMS=EXCEL setting from the documentation in SAS 9.3.

You might try adjusting the TypeGuessRow registry key setting for the version of Office you have (online SAS help has key depending on versions installed). The default setting by OFFICE, not SAS, is apparently 8 rows to guess whether a column is text or numeric on export.

SASKiwi
PROC Star

As further clarification MIXED = works with DBMS = XLS and XLSX in SAS 9.3 regardless of what the documentation says. In SAS 9.4 only MIXED = with DBMS = EXCEL now works, you will get an error if you use the other types. So only 9.4 is consistent with the documention.

We struck this problem while testing our SAS 9.3 to 9.4 migration.

DBMS = EXCEL should work for most Excel versions. I've tested it successfully with 2010. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 8 replies
  • 6356 views
  • 0 likes
  • 4 in conversation