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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 4408 views
  • 1 like
  • 1 in conversation