BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rinsabraham
Obsidian | Level 7

how to replace the same excel template output with new data but the columns has been increased in the new datasets.

 

refer the below code:

libname _ibxls 'c:\path\libname.xlsx';

proc datasets lib=_ibxls;

delete data;

run;

 

proc datasets lib=_ibxls;

delete 'data'$n ;

run;

proc append base=_ibxls.data data=abc;

run;

libname _ibxls clear;

 

my excel sheet had 2 columns and I have delete the data present in the sheet that has to be replaced with the new data.in my new dataset have  5 column .how do we  achieve the same templates for theses addition columns using above mentioned code.

 

Request you to please help me.

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

I don't think it is possible.  If your using a range in an Excel file, then the data output needs to match that range.  If you have to fit into your Excel template something which does not fit into that template...

All I can suggest is you update your Excel template's range to be big enough to handle any now or future additional areas, or find some other way to process the data as it comes in.  One way is to dump SAS data out to an Excel file, and then have your template file run some VBA code to pull that data into itself.

View solution in original post

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

I don't think it is possible.  If your using a range in an Excel file, then the data output needs to match that range.  If you have to fit into your Excel template something which does not fit into that template...

All I can suggest is you update your Excel template's range to be big enough to handle any now or future additional areas, or find some other way to process the data as it comes in.  One way is to dump SAS data out to an Excel file, and then have your template file run some VBA code to pull that data into itself.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 657 views
  • 2 likes
  • 2 in conversation