Custom Table Titles using macros?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom Table Titles using macros?

Jake Gross

SPSS Folks,

 

I am looking for help inserting the names of specific campuses into Custom Tables for a series of reports I am running for each institution. I adopted the following code from SPSS List Archives and have the reports running fine, but am curious to know if there is a way automatically insert the name of the Campus in the table title.

 

Here are my parameters

1)      I have a variable called “Campus_Name” that is the name of the campus.

2)      I want the custom table title to show the name of the campus for each custom table (17 in this case).

3)      A colleague showed me how to customize the table titles using a macro call specific to each campus, but I am curious if there is a way to adapt the code below using the “Campus_Name” variable.

 

DEFINE !CampusCredits().

!DO !campus=1 !TO 17.

COMPUTE filter_=(CampusGroup_04=!campus).

FILTER BY filter_.

CTABLES

  /VLABELS VARIABLES=AGE_cat_04 race04 gender04 Income_10k_04 FallHours_04 SpringHours_04 FULL_04_3

    CredThresh_04

    DISPLAY=DEFAULT

  /TABLE AGE_cat_04 [C] + race04 [C] + gender04 [C] + Income_10k_04 [C] + FallHours_04 [C] +

    SpringHours_04 [C] + FULL_04_3 [C] BY CredThresh_04 [C][COUNT F40.0, ROWPCT.COUNT PCT40.1,

    COLPCT.COUNT PCT40.1]

  /CATEGORIES VARIABLES=AGE_cat_04 race04 gender04 Income_10k_04 FallHours_04 SpringHours_04

    CredThresh_04 ORDER=A KEY=VALUE EMPTY=INCLUDE

  /CATEGORIES VARIABLES=FULL_04_3 ORDER=A KEY=VALUE EMPTY=EXCLUDE

  /TITLE Title=!QUOTE(!CONCAT('First-Time, First-Year, Cohort, 2004,', CAMPUS_NAME))

   CAPTION= 'Report created at )TIME on )DATE' ')TABLE'.

FILTER OFF.

!DOEND

!ENDDEFINE.

 

*Call macro.

!CampusCredits.

 

------------------------------

Jacob PK Gross

Associate Director for Research--Project on Academic Success

Indiana University

1900 E 10TH ST, SUITE 630

Bloomington IN, 47406

812-855-1604

812-855-0707 (Fax)

 

Reply | Threaded
Open this post in threaded view
|

Re: Custom Table Titles using macros?

Albert-Jan Roskam
You have to define the !campus_name argument
DEFINE !CampusCredits(campus_name = !cmdend).
..and then refer to it as !campus_name.

Cheers!!
Albert-Jan


--- On Mon, 3/30/09, Gross, Jacob P.K. <[hidden email]> wrote:

> From: Gross, Jacob P.K. <[hidden email]>
> Subject: Custom Table Titles using macros?
> To: [hidden email]
> Date: Monday, March 30, 2009, 10:03 PM
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> SPSS Folks,
>
>  �
>
> I am looking for help inserting the
> names of specific
> campuses into Custom Tables for a series of reports I am
> running for each
> institution. I adopted the following code from SPSS List
> Archives and have the
> reports running fine, but am curious to know if there is a
> way automatically
> insert the name of the Campus in the table title.
>
>  �
>
> Here are my parameters
>
> 1)� � � � �
> I have a variable called
> “Campus_Name” that
> is the name of the campus.
>
> 2)� � � � �
> I want the custom table title to show the
> name of the
> campus for each custom table (17 in this case).
>
> 3)� � � � �
> A colleague showed me how to customize the
> table titles
> using a macro call specific to each campus, but I am
> curious if there is a way
> to adapt the code below using the “Campus_Name”
> variable.
>
>  �
>
> DEFINE !CampusCredits().
>
> !DO !campus=1 !TO 17.
>
> COMPUTE
> filter_=(CampusGroup_04=!campus).
>
> FILTER BY filter_.
>
> CTABLES
>
> �  /VLABELS VARIABLES=AGE_cat_04
> race04 gender04
> Income_10k_04 FallHours_04 SpringHours_04 FULL_04_3
>
> � � �  CredThresh_04
>
> � � �  DISPLAY=DEFAULT
>
>
> �  /TABLE AGE_cat_04 [C] + race04
> [C] + gender04 [C] +
> Income_10k_04 [C] + FallHours_04 [C] +
>
> � � �  SpringHours_04 [C]
> + FULL_04_3 [C] BY
> CredThresh_04 [C][COUNT F40.0, ROWPCT.COUNT PCT40.1,
>
> � � �  COLPCT.COUNT
> PCT40.1]
>
> �  /CATEGORIES
> VARIABLES=AGE_cat_04 race04 gender04
> Income_10k_04 FallHours_04 SpringHours_04
>
> � � �  CredThresh_04
> ORDER=A KEY=VALUE
> EMPTY=INCLUDE
>
> �  /CATEGORIES VARIABLES=FULL_04_3
> ORDER=A KEY=VALUE
> EMPTY=EXCLUDE
>
> �  /TITLE
> Title=!QUOTE(!CONCAT('First-Time, First-Year,
> Cohort, 2004,', CAMPUS_NAME))
>
> � �  CAPTION= 'Report
> created at )TIME on )DATE'
> ')TABLE'.
>
> FILTER OFF.
>
> !DOEND
>
> !ENDDEFINE.
>
>  �
>
> *Call macro.
>
> !CampusCredits.
>
>  �
>
> ------------------------------
>
> Jacob PK Gross
>
> Associate Director for
> Research--Project on Academic Success
>
> Indiana University
>
> 1900 E 10TH ST, SUITE 630
>
> Bloomington IN, 47406
>
> 812-855-1604
>
> 812-855-0707 (Fax)
>
>  �
>
>
>
>
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD