Is there a way to use 'TO' in a 'CTABLES' command? I tried but maybe
the wrong way. In the code below you see v26a TO v26m. It would be great and easier to read if don't have to write each variable for itself in it. And a sidequestion: v26* is only 0(nocheckmark) or 1(checkmark). I want to supress the VALUE LABLES ("checkmark") in the table. CTABLES itself shows me now option for that if I understand it correct. So my current workaround is to set the lables temporary empty. Is there a nicer solution? TEMPORARY. VALUE LABELS v26a TO v26m 1 ' '. CTABLES /VLABELS VARIABLES=v26a v26b v26c v26d v26e v26f v26g v26h v26i v26j v26k v26l v26m DISPLAY=LABEL /VLABELS VARIABLES=v26Sn v01 DISPLAY=NONE /TABLE v26a [C][COUNT 'n' F40.0] + v26b [C][COUNT 'n' F40.0] + v26c [C][COUNT 'n' F40.0] + v26d [C][COUNT 'n' F40.0] + v26e [C][COUNT 'n' F40.0] + v26f [C][COUNT 'n' F40.0] + v26g [C][COUNT 'n' F40.0] + v26h [C][COUNT 'n' F40.0] + v26i [C][COUNT 'n' F40.0] + v26j [C][COUNT 'n' F40.0] + v26k [C][COUNT 'n' F40.0] + v26l [C][COUNT 'n' F40.0] + v26m [C][COUNT 'n' F40.0] +v26Sn [C][COUNT 'n' F40.0] BY v01 [C] /CLABELS COLLABELS=OPPOSITE /CATEGORIES VARIABLES=v26a [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26b [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26c [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26d [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26e [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26f [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26g [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26h [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26i [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26j [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26k [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26l [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26m [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26Sn ORDER=A KEY=VALUE EMPTY=EXCLUDE /CATEGORIES VARIABLES=v01 ORDER=A KEY=VALUE EMPTY=EXCLUDE TOTAL=YES POSITION=AFTER. ===================== 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 |
The VLABELS subcommand DISPLAY keyword
allows you to control whether value labels are used or not.
You cannot use TO in the table expression, but you can factor out all the common statistics. For example, /table (v26a+v26b+v26c+...)[count 'n'] You could, however, use the SPSSINC SELECT VARIABLES extension command (Utilities > Define Variable Macro) to generate a macro with the selected variable names separated with "+" and use that macro name in the table expression. SELECT VARIABLES can pick variables based on various criteria, and it does support TO and ALL. The SEPARATOR keyword on the OPTIONS subcommand is used to specify a + between variables instead of a blank. Putting this together, spssinc select variables macroname=!somevars variables=v26a to v26m /options separator="+. ctables ... /table (!somevars)[count 'n'] by v01 .... Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: Moon Kid <[hidden email]> To: [hidden email], Date: 04/22/2014 06:59 AM Subject: [SPSSX-L] TO in CTABLES? Sent by: "SPSSX(r) Discussion" <[hidden email]> Is there a way to use 'TO' in a 'CTABLES' command? I tried but maybe the wrong way. In the code below you see v26a TO v26m. It would be great and easier to read if don't have to write each variable for itself in it. And a sidequestion: v26* is only 0(nocheckmark) or 1(checkmark). I want to supress the VALUE LABLES ("checkmark") in the table. CTABLES itself shows me now option for that if I understand it correct. So my current workaround is to set the lables temporary empty. Is there a nicer solution? TEMPORARY. VALUE LABELS v26a TO v26m 1 ' '. CTABLES /VLABELS VARIABLES=v26a v26b v26c v26d v26e v26f v26g v26h v26i v26j v26k v26l v26m DISPLAY=LABEL /VLABELS VARIABLES=v26Sn v01 DISPLAY=NONE /TABLE v26a [C][COUNT 'n' F40.0] + v26b [C][COUNT 'n' F40.0] + v26c [C][COUNT 'n' F40.0] + v26d [C][COUNT 'n' F40.0] + v26e [C][COUNT 'n' F40.0] + v26f [C][COUNT 'n' F40.0] + v26g [C][COUNT 'n' F40.0] + v26h [C][COUNT 'n' F40.0] + v26i [C][COUNT 'n' F40.0] + v26j [C][COUNT 'n' F40.0] + v26k [C][COUNT 'n' F40.0] + v26l [C][COUNT 'n' F40.0] + v26m [C][COUNT 'n' F40.0] +v26Sn [C][COUNT 'n' F40.0] BY v01 [C] /CLABELS COLLABELS=OPPOSITE /CATEGORIES VARIABLES=v26a [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26b [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26c [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26d [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26e [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26f [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26g [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26h [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26i [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26j [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26k [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26l [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26m [1] EMPTY=INCLUDE /CATEGORIES VARIABLES=v26Sn ORDER=A KEY=VALUE EMPTY=EXCLUDE /CATEGORIES VARIABLES=v01 ORDER=A KEY=VALUE EMPTY=EXCLUDE TOTAL=YES POSITION=AFTER. ===================== 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 |
I find when working with dichotomous variables it's best to treat them as scale variables i.e. "[s]" rather than categorical i.e. "[c]" and use the SUM statistic to get the count of "Yes" as you are doing here and if required also...MEAN for proportion or % and VALIDN for base size. i.e. ctables /table (v26a + v26b + v26c) [s] [sum "Count" f8.0 mean "%" f8.2 validn f8.0] by v01 [C]
/slabels position=row.
This will avoid the need to specify the multiple CATEGORICAL VARIABLES sub commands. I generally always use a double SPSSINC SELECT VARIABLES command, one with "+" as a separator and the other with " " (space) as a separator. The first to be used in the definition of the TABLE and the second to be used in the VLABELS VARIABLES sub command.
i.e. spssinc select variables macroname="!somevars1" variables=v26a to v26m /options separator="+". spssinc select variables macroname="!somevars2" variables=v26a to v26m /options separator=" ".
On 22 April 2014 14:18, Jon K Peck <[hidden email]> wrote: The VLABELS subcommand DISPLAY keyword allows you to control whether value labels are used or not. |
In reply to this post by Jon K Peck
On 2014-04-22 07:18 Jon K Peck <[hidden email]> wrote:
> The VLABELS subcommand DISPLAY keyword allows you to control whether > value labels are used or not. Mhm... Maybe I missunderstanding something. But the DISPLAY keyword only controls the labels of the variable (VAR LABEL) but not the labels of the values (VALUE LABEL). That is the way it reacted on my test and I understand the docu. Am I wrong? ===================== 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 |
Free forum by Nabble | Edit this page |