display zero courts in frequencies

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

display zero courts in frequencies

Michael Pullmann
I have a variable with Likert scale response options (1-7). Zero
respondents endorsed a couple of options (2, 3) but I would like these
options and their frequencies (0s) to be displayed in the frequencies
output and histogram. Is there any way to do this? Thanks in advance.

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: display zero courts in frequencies

Bruce Weaver
Administrator
I assume you want a bar chart, not a histogram.  If so, take a look at this:

   http://www-01.ibm.com/support/docview.wss?uid=swg21476105

And for a table, you should be able to generate what you want with CTABLES.  I'm no expert on CTABLES, but here is something I cobbled together after taking a quick look at the FM.


NEW FILE.
DATASET CLOSE all.

DATA LIST free / X (f1).
BEGIN DATA
1 1 1 1 4 4 5 5 5 5 6 6 6 6 6 7 7 7 7 7
END DATA.

FREQUENCIES X.

CTABLES /TABLE X [count colpct]
 /CATEGORIES VARIABLES = X [1,2,3,4,5,6,7]
.

GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=x[LEVEL=ORDINAL] COUNT()
[rename="COUNT"] MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: x=col(source(s), name("x"), unit.category())
DATA: COUNT=col(source(s), name("COUNT"))
GUIDE: axis(dim(1), label("x"))
GUIDE: axis(dim(2), label("Count"))
SCALE: cat(dim(1), include("1", "2", "3", "4", "5", "6", "7"))
SCALE: linear(dim(2), include(0))
ELEMENT: interval(position(x*COUNT), shape.interior(shape.square))
END GPL.


HTH.



Michael Pullmann wrote
I have a variable with Likert scale response options (1-7). Zero
respondents endorsed a couple of options (2, 3) but I would like these
options and their frequencies (0s) to be displayed in the frequencies
output and histogram. Is there any way to do this? Thanks in advance.

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: display zero courts in frequencies

David Marso
Administrator
In reply to this post by Michael Pullmann
Some variation on this should suffice.
DATA LIST FREE / x.
BEGIN DATA
1 3 5 6
END DATA.
COMPUTE Wt=1.
DATASET NAME real.

DATA LIST FREE / x .
BEGIN DATA
1 2 3 4 5 6 7
END DATA.
COMPUTE wt=1E-16.
DATASET NAME weighted.
ADD FILES /FILE weighted/FILE real/IN=@real@.
WEIGHT BY wt.
FREQUENCIES x.


Michael Pullmann wrote
I have a variable with Likert scale response options (1-7). Zero
respondents endorsed a couple of options (2, 3) but I would like these
options and their frequencies (0s) to be displayed in the frequencies
output and histogram. Is there any way to do this? Thanks in advance.

=====================
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
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?"
Reply | Threaded
Open this post in threaded view
|

Re: display zero courts in frequencies

Jon K Peck
In reply to this post by Bruce Weaver
As long as X has a value label for each value, you don't need the CATEGORIES subcommand.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Bruce Weaver <[hidden email]>
To:        [hidden email],
Date:        04/25/2014 04:42 PM
Subject:        Re: [SPSSX-L] display zero courts in frequencies
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




I assume you want a bar chart, not a histogram.  If so, take a look at this:

 
http://www-01.ibm.com/support/docview.wss?uid=swg21476105

And for a table, you should be able to generate what you want with CTABLES.
I'm no expert on CTABLES, but here is something I cobbled together after
taking a quick look at the FM.


NEW FILE.
DATASET CLOSE all.

DATA LIST free / X (f1).
BEGIN DATA
1 1 1 1 4 4 5 5 5 5 6 6 6 6 6 7 7 7 7 7
END DATA.

FREQUENCIES X.

CTABLES /TABLE X [count colpct]
/CATEGORIES VARIABLES = X [1,2,3,4,5,6,7]
.

GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=x[LEVEL=ORDINAL] COUNT()
[rename="COUNT"] MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: x=col(source(s), name("x"), unit.category())
DATA: COUNT=col(source(s), name("COUNT"))
GUIDE: axis(dim(1), label("x"))
GUIDE: axis(dim(2), label("Count"))
SCALE: cat(dim(1), include("1", "2", "3", "4", "5", "6", "7"))
SCALE: linear(dim(2), include(0))
ELEMENT: interval(position(x*COUNT), shape.interior(shape.square))
END GPL.


HTH.




Michael Pullmann wrote
> I have a variable with Likert scale response options (1-7). Zero
> respondents endorsed a couple of options (2, 3) but I would like these
> options and their frequencies (0s) to be displayed in the frequencies
> output and histogram. Is there any way to do this? Thanks in advance.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/display-zero-courts-in-frequencies-tp5725682p5725683.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


Reply | Threaded
Open this post in threaded view
|

Re: display zero courts in frequencies

Andy W
In reply to this post by Michael Pullmann
Another slightly hacky option (although one that I would be ok with just for a quick check) is to use integer mode in CROSSTABS and specify a constant value for the BY variable. From this table you can select the cells of interest and make a chart.

For charts directly in syntax, in GGRAPH you can specify empty categories by using the [include] keyword within a [SCALE: cat] statement to include particular empty categories.

*******************************************.
DATA LIST free / X (f1).
BEGIN DATA
1 1 1 1 4 4 5 5 5 5 6 6 6 6 6 7 7 7 7 7
END DATA.

COMPUTE Const = 1.
*Crosstabs integer mode.
CROSSTABS VARIABLES=X(1,7) Const(1,1)
  /TABLES=X BY Const.

*Frequencies Bar Chart.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=X COUNT()[name="COUNT"] MISSING=LISTWISE
    REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: X=col(source(s), name("X"), unit.category())
  DATA: COUNT=col(source(s), name("COUNT"))
  GUIDE: axis(dim(1), label("X"))
  GUIDE: axis(dim(2), label("Count"))
  SCALE: cat(dim(1), include("1","2","3","4","5","6","7"))
  SCALE: linear(dim(2), include(0))
  ELEMENT: interval(position(X*COUNT), shape.interior(shape.square))
END GPL.
*******************************************.

It would be nice if include in inline GPL had a TO argument, e.g. [include(1 TO 7)] although that would take more intelligent mapping of numeric labeled categories (as you see you need to enclose the categories in quotation marks).
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: display zero courts in frequencies

Jon K Peck
The Chart Builder will automatically include all values with value labels when building the GPL syntax just as CTABLES does.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Andy W <[hidden email]>
To:        [hidden email],
Date:        04/27/2014 08:51 AM
Subject:        Re: [SPSSX-L] display zero courts in frequencies
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Another slightly hacky option (although one that I would be ok with just for
a quick check) is to use integer mode in CROSSTABS and specify a constant
value for the BY variable. From this table you can select the cells of
interest and make a chart.

For charts directly in syntax, in GGRAPH you can specify empty categories by
using the [include] keyword within a [SCALE: cat] statement to include
particular empty categories.

*******************************************.
DATA LIST free / X (f1).
BEGIN DATA
1 1 1 1 4 4 5 5 5 5 6 6 6 6 6 7 7 7 7 7
END DATA.

COMPUTE Const = 1.
*Crosstabs integer mode.
CROSSTABS VARIABLES=X(1,7) Const(1,1)
 /TABLES=X BY Const.

*Frequencies Bar Chart.
GGRAPH
 /GRAPHDATASET NAME="graphdataset" VARIABLES=X COUNT()[name="COUNT"]
MISSING=LISTWISE
   REPORTMISSING=NO
 /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: X=col(source(s), name("X"), unit.category())
 DATA: COUNT=col(source(s), name("COUNT"))
 GUIDE: axis(dim(1), label("X"))
 GUIDE: axis(dim(2), label("Count"))
 SCALE: cat(dim(1), include("1","2","3","4","5","6","7"))
 SCALE: linear(dim(2), include(0))
 ELEMENT: interval(position(X*COUNT), shape.interior(shape.square))
END GPL.
*******************************************.

It would be nice if include in inline GPL had a TO argument, e.g. [include(1
TO 7)] although that would take more intelligent mapping of numeric labeled
categories (as you see you need to enclose the categories in quotation
marks).



-----
Andy W
[hidden email]
http://andrewpwheeler.wordpress.com/
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/display-zero-courts-in-frequencies-tp5725682p5725688.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