BookmarkSubscribeRSS Feed
sas1011
Calcite | Level 5

Hello All,

 

Its my first question in this community so please pardon me if I missed out information that could be vital for a satisfactory response.

 

Background of concern:  I am currently running a program that generates a report. I want to export the generated datasets into an Excel workbook that already exists(This does not contain any data- it just includes the column names and sheets. I need to fill this sheet up with the data generated through my SAS Program). 

 

Status quo: Right now, I am exporting it into a new workbook, and then manually copying and pasting the values into the excel template workbook.

 

 

Q: Is there an option that I could use, that would allow me to export my dataset directly into the Excel template? 

 

P.S: I tried ods excel and specified the Excel template workbook name as the filename - but it replaces the formats and columns on the template with that of my dataset column names. 

 

Thank you.

5 REPLIES 5
SASKiwi
PROC Star

If you have a highly-customised Excel template then the best way to refresh this is from SAS is to write your SAS table to a separate "vanilla" data sheet, then have formulas in the template pointing to the data sheet to pick up the new data.

 

PROC EXPORT would be a good way of doing this.

Reeza
Super User

I concur with @SASKiwi, the easiest method is to create another sheet with the raw data in a clean unformatted way. Modify the template to link and format the data from this sheet in the actual report. 

Then when you replace that data the template is automatically updated. 

 

 

art297
Opal | Level 21

I don't want to get your hopes up but, if the exportxl macro will work on your system, it can be used to do the job. It was designed so that it can take advantage of both an excel template and/or using an existing excel workbook as a template. You can download the both the macro, and its documentation, at: http://www.sascommunity.org/wiki/Excelling_to_Another_Level_with_SAS

 

Art., CEO, AnalystFinder.com

 

sas1011
Calcite | Level 5

Thanks all.

 

I think what Art mentioned got me closer to where I wanted to get, if not completely.

 

I will keep trying for more ways but all your answers did help me. 

art297
Opal | Level 21

If the macro worked on your system, post the code that you used to call the macro and let us know what you weren't able to accomplish.

 

Art, CEO, AnalystFinder.com

 

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 5 replies
  • 5615 views
  • 5 likes
  • 4 in conversation