BookmarkSubscribeRSS Feed
rakeshvvv
Quartz | Level 8

how can convert excel file into sas dataset using infile statement.....I was using proc import but values are getting truncated........my excel has 1st row as variable names and every collumn in excel corresponds to variable name...can someone help infile statement for this kind of excel....

2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12

Reading Excel via a DATA step is painful and Excel version dependent.  You might have a chance with .xlsx files as they are stored as .xml files.

When I have that problem, there are a couple of approaches to take.

-- look at the SCANTEXT and TEXTSIZE options in PROC IMPORT.  They may need to be changed to control truncation.

-- use SAS Enterprise Guide to read the data.  I fined it a bit more flexible than IMPORT for messy data.

PGStats
Opal | Level 21

LIBNAME gives you the most flexibility. Yet, in Excel data type is defined at the cell level and you are trying to import the data into a (database) structure where data type is defined on a column basis.

Sometimes, when possible, the simplest way to successful importation is to modify the Excel sheet. Sometimes, you must read cell values as character and accept the incurring loss of precision. No solution is optimal in all cases.

Please post an example of your data to get more specific advice.

PG

PG

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
  • 919 views
  • 1 like
  • 3 in conversation