BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14
Hello
I have 3 macros that creating 3 types of output tables.
I run these macros for 2 populations
(Symboled by and b)


Step1;Macro1 on population a.
Create 6 tables for population a.
Names of tables:
Tbl_1_1_a Tbl_1_2_a Tbl_1_3_a
Tbl_1_4_a Tbl_1_5_a Tbl_1_6_a

Step2;Macro2 on population a.
Create 3 tables for population a.
Names of tables:
Tbl_2_1_a Tbl_2_2_a Tbl_2_3_a


Step3;Macro1 on population b.
Create 6 tables for population b.
Names of tables:
Tbl_1_1_b Tbl_1_2_b Tbl_1_3_b
Tbl_1_4_b Tbl_1_5_b Tbl_1_6_b

Step4;Macro2 on population b.
Create 3 tables for population b.
Names of tables:
Tbl_2_1_b Tbl_2_2_b Tbl_2_3_b


Step5-Here is my question.
I want to export the table to one excel file with following requirements:
Name of sheet1 will be output1.
In sheet1 there will be tables Tbl_1_1_a Tbl_1_2_a Tbl_1_3_a
Tbl_1_4_a Tbl_1_5_a Tbl_1_6_a
down each other
and parallel to them will be tables
Tbl_1_1_b Tbl_1_2_b Tbl_1_3_b
Tbl_1_4_b Tbl_1_5_b Tbl_1_6_b
also down each other .

Name of sheet2 will be output2.
In sheet2 there will be tables
Tbl_2_1_a Tbl_2_2_a Tbl_2_3_a down each other
And parallel to them will be tables
Tbl_2_1_b Tbl_2_2_b Tbl_2_3_b
Can anyone send a code that can do step5 of export to excel??
I dont have any requirement regarding colors and styles of tables .

Thank you so much





7 REPLIES 7
Ronein
Meteorite | Level 14
Sorry.
I have 2 macros that creating 2 types of output tables.
I run these macros for 2 populations
(Symboled by a and b)
Reeza
Super User

AFAIK there isn't an easy way to do this at this point of time - which is why you've asked the same question three times and not received a response. The closest option that I'm aware of uses ODS HTML, but that will not generate a native Excel file and does not support multiple sheets easily.


The other two options, the custom macro written by some users here and/or DDE. Those are the order I'd suggest those in as well.

 

http://www.sascommunity.org/wiki/A_Poor/Rich_SAS_Users_Proc_Export

 

Given your post, the macro above seems like your best option.


Good Luck.

 

 

art297
Opal | Level 21

@Ronein: I agree with @Reeza, but suggest that you use the most recent version of that macro. You can find it at:

https://github.com/FriedEgg/Papers/tree/master/Excelling_to_Another_Level_with_SAS

 

Art, CEO, AnalystFinder.com

 

Note: Corrected link. Code is under SRC, while all documentation is under doc

 

Ronein
Meteorite | Level 14
Hi Reeeza
Thanks for your reply.
I opened the link you sent but can't see there any code.
Can you please tell me where to go in this link ?
Ronein
Meteorite | Level 14
Hi art297
Thank you very much.
Can you tell me please which file to open in your link ?
art297
Opal | Level 21

Oops! The code obviously wasn't downloaded as yet to the github page, and the page owner is currently at SGF. As such, here is where you can get it: http://www.sascommunity.org/wiki/Excelling_to_Another_Level_with_SAS

 

Art, CEO, AnalystFinder.com

 

DWilson
Pyrite | Level 9

Nifty macro. I note that it only works for Windows. If you have SAS on a non-windows operating system, you could create your own macro as we did. It uses SAS IML to interface with R (pass SAS data sets and R code) to call 3rd party R packages (either openxlsx or xlConnect) to allow us to write to cells without having to pre-specify ranges in advance. It also allows us to use pre-specified excel templates with formatting and whatnot applied.

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 7 replies
  • 828 views
  • 0 likes
  • 4 in conversation