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-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!

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
  • 1916 views
  • 3 likes
  • 3 in conversation