Reputation: 1875
I want to export a table generated by PROC TABULATE
. My code goes like this:
ODS EXCEL FILE="myFile.xlsx" (options sheet_name="CRIME TYPE");
PROC TABULATE DATA=myData;
TITLE 'myTitle';
BY crime_type;
CLASS year;
CLASS nation / ORDER=FREQ;
TABLES year, nationality / CONDENSE;
RUN;
ODS EXCEL CLOSE;
This creates me an excel file with different sheets:
THEFT
country1 country2 country3 ...
--------------------------------------
1990
1991
1992
--------------------------------------
ASSAULT
country1 country2 country3 ...
--------------------------------------
1990
1991
1992
--------------------------------------
Unfortunately, the sheets do not have the names of the different crimes (theft, assault, …) but are called "CRIME TYPE 1", "CRIME TYPE 2" and so forth (SHEET_NAME="CRIME TYPE"
).
Does anyone know how to name the sheets according to the values of the variable crime_type
?
Upvotes: 1
Views: 6408
Reputation: 1770
If you want to name the sheets using values of crime_type
variable, you can use options(sheet_name='#byval1')
instead (options sheet_name="CRIME TYPE")
Upvotes: 2
Reputation: 59
try this solution from SAS support https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-Excelxp-PROC-TABULATE-multiple-sheets/td-p/359181
Upvotes: 0