2
votes

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?

2

2 Answers

5
votes

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")