Syntax for selecting variables for specific variable levels

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

Syntax for selecting variables for specific variable levels

clinton@bmi-t.co.za
Hi

I'm trying to create generic syntax to show all scale variables similar to:

CTABLES
 /VLABELS VARIABLES=Q_10 VAR00001
  DISPLAY=LABEL
 /TABLE Q_10 [S][MEAN, MEDIAN, MODE, VALIDN F40.0] BY VAR00001
 /CATEGORIES VARIABLES=VAR00001 ORDER=A KEY=VALUE EMPTY=EXCLUDE

How many full time employees does your whole company/organisation have in total?
VAR00001 = Total
Mean  Median Mode  Valid N
449  58        10  102

but instead of just Q_10 I want all scale variables, I've tried numerous variations on the syntax below but I cannot get it right

CTABLES
 /VLABELS SELECT IF (VARIABLE LEVEL {SCALE})  VAR00001
  DISPLAY=LABEL
 /TABLE (VARIABLE LEVEL {SCALE}) [S][MEAN, MEDIAN, MODE, VALIDN F40.0] BY VAR00001
 /CATEGORIES VARIABLES=VAR00001 ORDER=A KEY=VALUE EMPTY=EXCLUDE

Any advice would be much appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: Syntax for selecting variables for specific variable levels

Jon Peck
In order to select all the scale variables for use in CTABLES, use syntax like this.
SPSSINC SELECT VARIABLES MACRONAME="!scale" 
/PROPERTIES LEVEL=SCALE  
/OPTIONS  SEPARATOR="+".

This is an extension command normally installed with Statistics (Utilities > Define Variable Macro).  It generates a macro listing all the scale variables using + as the separator.  Then in CTABLES do something like

CTABLES
  /TABLE !scale [MEAN] BY var00001
  /CATEGORIES VARIABLES=var00001 
  /CRITERIA CILEVEL=95.



On Tue, Aug 22, 2017 at 1:13 PM, [hidden email] <[hidden email]> wrote:
Hi

I'm trying to create generic syntax to show all scale variables similar to:

CTABLES
 /VLABELS VARIABLES=Q_10 VAR00001
  DISPLAY=LABEL
 /TABLE Q_10 [S][MEAN, MEDIAN, MODE, VALIDN F40.0] BY VAR00001
 /CATEGORIES VARIABLES=VAR00001 ORDER=A KEY=VALUE EMPTY=EXCLUDE

How many full time employees does your whole company/organisation have in
total?
VAR00001 = Total
Mean  Median    Mode  Valid N
449       58            10        102

but instead of just Q_10 I want all scale variables, I've tried numerous
variations on the syntax below but I cannot get it right

CTABLES
 /VLABELS SELECT IF (VARIABLE LEVEL {SCALE})  VAR00001
  DISPLAY=LABEL
 /TABLE (VARIABLE LEVEL {SCALE}) [S][MEAN, MEDIAN, MODE, VALIDN F40.0] BY
VAR00001
 /CATEGORIES VARIABLES=VAR00001 ORDER=A KEY=VALUE EMPTY=EXCLUDE

Any advice would be much appreciated.



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Syntax-for-selecting-variables-for-specific-variable-levels-tp5734725.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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



--
Jon K Peck
[hidden email]

===================== 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