%macro test(year=%str(),mon1=str%(),mon2=str%(), id=str%(),element=str%());
.
.
.
ods excel options(sheet_name="&id. &idname." sheet_interval="none" embedded_titles='yes');
title; proc odstext;
p "Long title" / style=[color=black font_weight=bold];
p "";
p "&elem." / style=[color=black font_weight=bold];
run;
proc print data=output_&elem._&idname. noobs;
run;
%mend test;
ods excel file="C:\Users\name\Documents\test\Tabs Test.xlsx";
%test (year=2021,mon1=Jan,mon2=Feb,id=1,element=elem1);
%test (year=2021,mon1=Jan,mon2=Feb,id=1,element=elem2);
%test (year=2021,mon1=Jan,mon2=Feb,id=1,element=elem3);
%test (year=2021,mon1=Jan,mon2=Feb,id=1,element=elem4);
%test (year=2021,mon1=Jan,mon2=Feb,id=1,element=elem5);
%test (year=2021,mon1=Jan,mon2=Feb,id=2,element=elem1);
%test (year=2021,mon1=Jan,mon2=Feb,id=2,element=elem2);
%test (year=2021,mon1=Jan,mon2=Feb,id=2,element=elem3);
%test (year=2021,mon1=Jan,mon2=Feb,id=2,element=elem4);
%test (year=2021,mon1=Jan,mon2=Feb,id=2,element=elem5); ods excel close; Thank you for your responses. After going through each, I've decided to share some of my relevant code (altered slightly of course). The three dots at the top indicate sections of code I've omitted that brings in data, matches specific data, and creates the tables I need for my output. So far, this code generates ten tables onto a single sheet. I would like to ideally have a tab for each ID with five tables for each element. Hopefully this gives a rough idea of what I have and what I'm trying to do... I'm pretty much a beginner in SAS, so again please bare with me.
... View more