As per my understanding libname can connect to excel files and create SAS libraries for the same and the proc import can do the same job. Also, I think libname cannot import unstructured data but proc import can. Is my understanding correct?
Also what other differences does both of these features have i.e. what is the difference between libname and proc import.
Both proc import with dbms=excel and libname excel try their best in guessing the types for columns in the spreadsheet. But it is still, for both, guesswork, and will not lead to consistently repeatable results.Types, lengths, formats may change with what is contained in the rows that they inspect for making the guesses.
So your best bet is always to use an other, text-based file format for bringing spreadsheet data into SAS. This allows you (by using the same data step, not proc import!) to have full control over the process.
libname allows you to use proc copy to "bulk import" several spreadsheets contained in a workbook. proc import can only import one sheet at a time.
Hi kurt,
Thanks for your prompt reply but if we are not talking in the context of excel, what all other differences does libname and proc import have?
Thanks for the effort,
Shivansh
proc import can read flat (text) files, while libnames always need some kind of database-like structure in the resources they access.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.