In my custom tables code I managed to shorten this section using a couple of simple macros without arguments...sNC to LNC
CTABLES /VLABELS VARIABLES=AState EntryChange.07 EntryChange.08 EntryChange.09 EntryChange.10 EntryChange.11 EntryChange.12 EntryChange.13 EntryChange.14 EntryChange.15 DISPLAY=LABEL ........ The section above changed to that which is below using the simple aforementioned macros.. define sNC () EntryChange.07 !enddefine. define LNC () EntryChange.15 !enddefine. CTABLES /VLABELS VARIABLES=AState sNC to LNC DISPLAY=LABEL Can't figure out how to do something similar with the section below...any help would be greatly appreciated...Thanks. /TABLE AState [C] BY EntryChange.07 [MODE 'Percent Change' F40.1] + EntryChange.08 [MODE 'Percent Change' F40.1] + EntryChange.09 [MODE 'Percent Change' F40.1] + EntryChange.10 [MODE 'Percent Change' F40.1] + EntryChange.11 [MODE 'Percent Change' F40.1] + EntryChange.12 [MODE 'Percent Change' F40.1] + EntryChange.13 [MODE 'Percent Change' F40.1] + EntryChange.14 [MODE 'Percent Change' F40.1] + EntryChange.15 [MODE 'Percent Change' F40.1] ===================== 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 |
You can factor out the measurement level and statistics specification in the TABLE subcommand by using parentheses for grouping. E.g., /table x by (y+z)[C][MODE 'some label' F40.1]. The syntax pasted from the CTABLES canvas doesn't use this factoring, so many users don't know that it is possible. On Tue, Dec 13, 2016 at 2:48 PM, SUBSCRIBE SPSSX-JohnF <[hidden email]> wrote: In my custom tables code I managed to shorten this section using a couple of simple macros without arguments...sNC to LNC |
In reply to this post by SUBSCRIBE SPSSX-JohnF
Thank you for the response, unfortunately I am missing something, I still need to include values for the intervening years.... I did the following:
CTABLES /VLABELS VARIABLES=AState fsvC to LsvC DISPLAY=LABEL /TABLE AState [C] BY (fsvC + LsvC)[MODE'Percent Change' F40.1] /CATEGORIES VARIABLES=AState ORDER=A KEY=VALUE EMPTY=INCLUDE /TITLES It only presents the 07 and 15 change. Can I create another macro without arguments representing the 07 thru 15? ===================== 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 |
Administrator
|
Why does it need to be a macro without arguments?
Send a MACRO with the CTABLES code some arguments and use a macro !DO loop Tons of examples in this list!!! ---
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
In reply to this post by SUBSCRIBE SPSSX-JohnF
You need the "+" in the TABLE command, but you could put all these in the macro. Note that the SPSSINC SELECT VARIABLES (Utilties > Define Variable Macro) extension command can make the macro for you, and it allows you to specify the separator in the variable list, so it fits with CTABLES. On Tue, Dec 13, 2016 at 3:32 PM, SUBSCRIBE SPSSX-JohnF <[hidden email]> wrote: Thank you for the response, unfortunately I am missing something, I still need to include values for the intervening years.... I did the following: |
Administrator
|
In reply to this post by David Marso
*UNTESTED*.
DEFINE !CatTable (!POS !TOKENS(1) /!POS !TOKENS(1) ) !LET !LIST = !NULL !LET !TabList=!NULL !DO !I=!1 !TO !2 !LET !LIST =!CONCAT(!LIST, !I, !BLANKS(1) ) !DOEND !DO !I = !1 !TO !2 !LET !J=!HEAD(!List) !LET !X=!J !LET !List=!TAIL(!List) !IF(!LENGTH(!J) !EQ 1 !THEN !LET !X = !CONCAT('0',!I) !IFEND !LET !TabList=!CONCAT(!TabList,'EntryChange.',!X) !IF !TAIL(!List) !NE "" !THEN !LET !TabList = !CONCAT(!TabList," + ") !IFEND CTABLES /VLABELS VARIABLES=AState !CONCAT('EntryChange.',!1,' to ',EntryChange.',!2) DISPLAY=LABEL /TABLE AState [C] BY (!TabList)[MODE'Percent Change' F40.1] /CATEGORIES VARIABLES=AState ORDER=A KEY=VALUE EMPTY=INCLUDE /TITLES !ENDDEFINE .
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Free forum by Nabble | Edit this page |