BookmarkSubscribeRSS Feed
danimian
Calcite | Level 5

Hello,

We are using PROC IMPORT for Excel and reading excel formulas as cell value. As far as we have a numeric return value as a result of this formula then getting right results in our data set. But the problem is when we have text value as a result of this formula then not recieving the result text. It seams Proc Import for excel formula function only if the return value is numeric.

How to solve this problem for getting the text values as a result of excel formula? or it is not possible?

For example:

A1 has formula =F2

A2 has formula =F3

Cell Values

F2 has value 1234

F3 has value ABC

When we run proc import then getting the following results:

Correct: A1 = 1234

Wrong: A2 = here come nothing or some strange text???

Any help would be greatly appreciated.

Dani

25 REPLIES 25
Ksharp
Super User

add mixed=yes  option in proc import .

Xia Keshan

danimian
Calcite | Level 5

I just tried it with mixed=yes option in proc import but unfortunately its not helping.

LinusH
Tourmaline | Level 20

It works for me.

Please attach the log, with your code.

proc import dbms=excel file='C:\temp\test formler.xlsx' out=test;

    mixed=yes;

run;

Data never sleeps
danimian
Calcite | Level 5

Thanks for quick responses.

Please apply it with different excel sheets. It means if you execute same proc import again for another excel sheet with different values then you will not get the new values for new sheet. It returns only the value which read first time.

LinusH
Tourmaline | Level 20

Not quite following you.

Can you describe step by step how to reproduce your problem?

Data never sleeps
danimian
Calcite | Level 5

Excel file name is myfile.xlsx and sheet name is firstsheet.

This runs fine and return the correct values from sheet=firstsheet.

proc import

datafile="myfile.xlsx"

out=work.myreport

dbms=XLSX replace;

sheet=firstsheet;

getnames=no;

mixed=yes;

run;

Excel file name is same myfile.xlsx and sheet name is secondsheet.

Now if you create another sheet=secondsheet; change the excel entries in this sheet and run the following for secondsheet. you will not get the result of secondsheet. It will still show you the result of firstsheet.

proc import

datafile="myfile.xlsx"

out=work.myreport

dbms=XLSX replace;

sheet=secondsheet;

getnames=no;

mixed=yes;

run;

I hope you will understand the problem now.

Tom
Super User Tom
Super User

You might want to report that to SAS Support. Technical Support Form

Reeza
Super User

Your DBMS is set to XLSX rather than Excel. Try switching it.

danimian
Calcite | Level 5

As I mentioned I am reading XLSX file (myfile.xlsx). DBMS = XLSX is right.


Reeza
Super User

So you tried it and it didn't work?

danimian
Calcite | Level 5

Yes.

DBMS = EXCEL don't work for XLSX files.

Reeza
Super User

What version of Excel, SAS are you on? And what bit(s)? 32 or 64 bit for SAS and/or Excel?

danimian
Calcite | Level 5


Excel 2010

SAS Enterprise Guide, Version 5.1 Hot fix 16 (32-Bit)

Reeza
Super User

Use the Wizard then. It allows you to specify the type of variable in the wizard and make sure to select character.

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!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 25 replies
  • 7337 views
  • 0 likes
  • 9 in conversation