BookmarkSubscribeRSS Feed
Raman
Calcite | Level 5

Hi all

I have n number of excel sheet.

Each excel sheet has 2 worksheet.

I want to prepare master sheet where each excel sheet worksheet 1 is concatenated and put in to master excel worksheet 1

and similarly each excel sheet worksheet 2 is combined and put into same master excel but worksheet 2.

All teh sheet has same column names and that is not a problem

Can any of you let me know is it possible to do this using SAS and if so can you let me know how to approach this ?

Thanks

Ramanan

3 REPLIES 3
Ksharp
Super User

Yes. You can do it . Using Libname + excel to operate these Sheets just like SAS datasets.

Raman
Calcite | Level 5

thanks Ksharp...

If it is possible can you pls post the sample code  here..that would be useful for me to develop from here,,,

Ksharp
Super User

OK. Here is an example.

libname a1 excel 'c:\a1.xls' getnames=yes;
libname a2 excel 'c:\a2.xls' getnames=yes;
data sheet1;
 set a1.'Sheet1$'n a2.'Sheet1$'n;
run;
data sheet2;
 set a1.'Sheet2$'n a2.'Sheet2$'n;
run;


proc export data=sheet1 outfile='c:\main.xls' dbms=xls ;
                         sheet='Sheet1'; putnames=yes; run;
proc export data=sheet2 outfile='c:\main.xls' dbms=xls ;
                         sheet='Sheet2'; putnames=yes; run;

libname _all_ clear;

Ksharp

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
  • 3 replies
  • 2122 views
  • 0 likes
  • 2 in conversation