BookmarkSubscribeRSS Feed
🔒 This topic is locked. We are no longer accepting replies to this topic. Need further help? Please sign in and ask a new question.
SAS_Tipster
Moderator

If you are a beginner like me and have to work with Excel files, this should help you.

 

Scenario Suppose you have an Excel file named abc.xlsx that has multiple sheets and let xyz be one of those sheets. Further, suppose that within that sheet you want to extract data from the region B4:H200 and create a SAS data set. This is how you can accomplish this!

 

proc sql;
	connect to Excel (path="c:\somedirectory\abc.xlsx");
	create table SasDataset as select * from connection to Excel (select * from [xyz$B4:H200]);
	disconnect from Excel;
quit;

Note: The code uses column values from the first row to create variable names. See TS-792

 

Thanks to Mysterious Contributor for sharing this tip.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Visit a random SAS tip This SAS Tips board is not open for replies or comments, but we welcome your feedback and questions. Have a question or comment about this tip? Start a new topic in one of our discussion boards, and reference this tip topic.
Discussion stats
  • 0 replies
  • 3974 views
  • 1 like
  • 1 in conversation