SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Proc Import Excel - Reading Formula Problem

Reply
Contributor
Posts: 24

Proc Import Excel - Reading Formula Problem

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

Super User
Posts: 10,041

Re: Proc Import Excel - Reading Formula Problem

add mixed=yes  option in proc import .

Xia Keshan

Contributor
Posts: 24

Re: Proc Import Excel - Reading Formula Problem

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

Super User
Posts: 5,432

Re: Proc Import Excel - Reading Formula Problem

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
Contributor
Posts: 24

Re: Proc Import Excel - Reading Formula Problem

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.

Super User
Posts: 5,432

Re: Proc Import Excel - Reading Formula Problem

Not quite following you.

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

Data never sleeps
Contributor
Posts: 24

Re: Proc Import Excel - Reading Formula Problem

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.

Super User
Super User
Posts: 7,060

Re: Proc Import Excel - Reading Formula Problem

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

Super User
Posts: 19,822

Re: Proc Import Excel - Reading Formula Problem

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

Contributor
Posts: 24

Re: Proc Import Excel - Reading Formula Problem

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


Super User
Posts: 19,822

Re: Proc Import Excel - Reading Formula Problem

So you tried it and it didn't work?

Contributor
Posts: 24

Re: Proc Import Excel - Reading Formula Problem

Yes.

DBMS = EXCEL don't work for XLSX files.

Super User
Posts: 19,822

Re: Proc Import Excel - Reading Formula Problem

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

Contributor
Posts: 24

Re: Proc Import Excel - Reading Formula Problem


Excel 2010

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

Super User
Posts: 19,822

Re: Proc Import Excel - Reading Formula Problem

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

Ask a Question
Discussion stats
  • 25 replies
  • 3211 views
  • 0 likes
  • 9 in conversation