BookmarkSubscribeRSS Feed
Jdesai123
Calcite | Level 5

How do I import a particular column in Excel which utilize Formula to generate values using PROC IMPORT?

 

I am using following code and per my understanding SAS should automatically generate values in the field solving formula.

 

Ex. Excel File: COL_C is based on the formula (100-COLA).

 

proc import datafile= "..\Temp\test.xlsx" dbms=xlsx out= test replace;
sheet="temp";
getnames=YES;
run; quit;

 

While importing, COLA and COLB gets correct value while COLC is generating all missing values.

3 REPLIES 3
art297
Opal | Level 21

Impossible (for me at least) to tell without seeing the file.

 

Art, CEO, AnalystFinder.com

ballardw
Super User

Do you get any messages in the log? Post the code and messages from the log.

 

Is he formula actually:  = 100 - A2

or does is have one of $ modifiers like  = 100 - A$2 or 100 - $A2 ?

 

Does the cell address reference the result of another cell containing a formula?

 

Also depending on spreadsheet the variable may be getting assigned a numeric variable type in SAS but for some reason the result of the forumla is behaving like character and hence gets a missing value in SAS.

 

Easiest may be to SAVE As CSV and import the resulting CSV file.

Jdesai123
Calcite | Level 5
Hi,

I re-do the Formula and it worked fine.

I think Formula was saving as Character while converting so it was not
resolving while converting.

Thank you all for the help.

##- Please type your reply above this line. Simple formatting, no
attachments. -##

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 452 views
  • 0 likes
  • 3 in conversation