BookmarkSubscribeRSS Feed
rockerd
Fluorite | Level 6

Hi,

I am importing data from an excel file. I see that whenever SAS sees that a column was left blank even if it was numeric, it treats it like a character variable. This causes problems when I am inserting the excel file records into my master SAS file which has some numeric columns that are imported as character in excel imported data.

Is there any way I can force lengths and formats for the Columns in excel file to be imported?

currently used script:

proc import

    datafile="C:\Data\myDATA.xls"

    dbms=XLS

    out=test   ;

    guessingrows=10000;

run;

Thanks.

2 REPLIES 2
Reeza
Super User

Not as far as I know...

The guessingrows option is also invalid in proc import with Excel

A couple of things you might look into:

1) converting excel file to CSV and doing a proc import. Modify the SAS generated code to make sure your formats are the way you want them to be.

2) Read file with DDE

3) Can try the Force option in proc append, but not sure how that would work. If all the variable that were mismatched are missing in the new set it could be fine, but if variables that are not missing are in diff format you would lose information.

4) If all files are the same, try the option mixed=yes on all files to see if the imports are consistent.

manojinpec
Obsidian | Level 7

No idea on this.May be i will check and see if i can help .:)

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 2093 views
  • 3 likes
  • 3 in conversation