Creating automatic dummies

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

Creating automatic dummies

Tore Viland

Dear SPSS list,

 

I have a question concerning creating automatic dummies in SPSS  17. Earlier I have used Stata. In Stata one is allowed to create dummies using the “xi” function.  If one would like to do a regression analysis for the wage development over years one can simply say “xi: reg wage i.years” and the program will then create individual dummies for each year automatically. However, in SPSS I find this hard to do, the result being manually creating a dummy for each year.

 

Anyone have any suggestions on how to apply this Stata command in SPSS?

 

Best,

 

Tore

 

Reply | Threaded
Open this post in threaded view
|

Re: Creating automatic dummies

Peck, Jon
You can, of course, use GLM, treating the relevant variables as factors. But there is also an extension command named SPSSINC CREATE DUMMIES that can be downloaded from SPSS Developer Central, www.spss.com/devcentral. It will create a set of dummies suitable for Regression, all nicely labelled. It can create a macro defining these variables in order to make referencing the set convenient.

This requires the Python plugin, but no Python knowledge is needed to use it.

HTH,
Jon Peck


From: SPSSX(r) Discussion <[hidden email]>
To: [hidden email] <[hidden email]>
Sent: Tue Jun 16 04:40:48 2009
Subject: [SPSSX-L] Creating automatic dummies

Dear SPSS list,

 

I have a question concerning creating automatic dummies in SPSS  17. Earlier I have used Stata. In Stata one is allowed to create dummies using the “xi” function.  If one would like to do a regression analysis for the wage development over years one can simply say “xi: reg wage i.years” and the program will then create individual dummies for each year automatically. However, in SPSS I find this hard to do, the result being manually creating a dummy for each year.

 

Anyone have any suggestions on how to apply this Stata command in SPSS?

 

Best,

 

Tore

 

Reply | Threaded
Open this post in threaded view
|

Re: Creating automatic dummies

Johnny Amora
In reply to this post by Tore Viland
This might be helpful.
 
Consider a categorical variable RACE with values white, black and others which are coded 1, 2 and 3, respectively.
 
Here is the syntax to create new dummy variables WHITE and BLACK:
 
FREQUENCIES /VARIABLES=RACE.
COMPUTE WHITE=0.
COMPUTE BLACK=0.
IF RACE=1 WHITE=1.
IF RACE=2 BLACK=1.
FREQUENCIES /VARIABLES= WHITE BLACK.
 
Note:  Frequency tables for the original variable RACE and for the created dummies are generated for such syntax.
 
Cheers,
Johnny


--- On Tue, 6/16/09, Tore Viland <[hidden email]> wrote:

From: Tore Viland <[hidden email]>
Subject: Creating automatic dummies
To: [hidden email]
Date: Tuesday, 16 June, 2009, 4:40 PM

Dear SPSS list,

 

I have a question concerning creating automatic dummies in SPSS  17. Earlier I have used Stata. In Stata one is allowed to create dummies using the “xi” function.  If one would like to do a regression analysis for the wage development over years one can simply say “xi: reg wage i.years” and the program will then create individual dummies for each year automatically. However, in SPSS I find this hard to do, the result being manually creating a dummy for each year.

 

Anyone have any suggestions on how to apply this Stata command in SPSS?

 

Best,

 

Tore

 


Cleaner, Better, Faster - Yahoo! Mail: Now without ads. Experience it today!
Reply | Threaded
Open this post in threaded view
|

Accessing Menu Bar

Gary Rosin
In reply to this post by Peck, Jon
This is just a complaint.  A constant minor irritant in SPSS/PASW
is that it does not use the standard Alt key Windows protocol for
accessing the menu bar.  Way back to Word for MS-Dos, I got
used to using, say Alt, F, S for "F)ile S)ave, instead of Ctrl+s.
SPSS beeps at me when I try that, then inserts characters in the
active datacell.

=====================
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: Accessing Menu Bar

SPSS Support
Hi Gary,
  I've tested the Alt-FS successfully in versions 15, 16, and 17. Which version of Statistics and which operating system are you running now?
If you just hit Alt-F, does the File menu appear?
If the file hasn't been changed since your last save, the Save item will be greyed out when you do open the File menu and the file won't be saved. However, when I use ALT-FS in this situation, the program doesn't beep at me or insert characters in the data cell.

David Matheson
SPSS Statistical Support

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Gary Rosin
Sent: Tuesday, June 16, 2009 3:58 PM
To: [hidden email]
Subject: Accessing Menu Bar

This is just a complaint.  A constant minor irritant in SPSS/PASW
is that it does not use the standard Alt key Windows protocol for
accessing the menu bar.  Way back to Word for MS-Dos, I got
used to using, say Alt, F, S for "F)ile S)ave, instead of Ctrl+s.
SPSS beeps at me when I try that, then inserts characters in the
active datacell.

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

=====================
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: Accessing Menu Bar

Meyer, Gregory J
David, I think the issue is that unlike other programs, SPSS 17 (and
17.02) requires that you continue to hold the Alt key to keep the menu
activated while submitting another key. In other programs (including
SPSS 15) just clicking the Alt key activates the menu and it stays
activated until the next key is pressed. This may seem like a small
issue, but I strongly prefer to use keyboard commands over the mouse and
given that 17 doesn't work like all the other programs I use, I continue
to use v15 for almost all of my data analysis.

Greg

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
SPSS Support
Sent: Wednesday, June 17, 2009 2:00 PM
To: [hidden email]
Subject: Re: Accessing Menu Bar

Hi Gary,
  I've tested the Alt-FS successfully in versions 15, 16, and 17. Which
version of Statistics and which operating system are you running now?
If you just hit Alt-F, does the File menu appear?
If the file hasn't been changed since your last save, the Save item will
be greyed out when you do open the File menu and the file won't be
saved. However, when I use ALT-FS in this situation, the program doesn't
beep at me or insert characters in the data cell.

David Matheson
SPSS Statistical Support

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Gary Rosin
Sent: Tuesday, June 16, 2009 3:58 PM
To: [hidden email]
Subject: Accessing Menu Bar

This is just a complaint.  A constant minor irritant in SPSS/PASW
is that it does not use the standard Alt key Windows protocol for
accessing the menu bar.  Way back to Word for MS-Dos, I got
used to using, say Alt, F, S for "F)ile S)ave, instead of Ctrl+s.
SPSS beeps at me when I try that, then inserts characters in the
active datacell.

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

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

=====================
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: Accessing Menu Bar

Gary Rosin
That's what it is, I use separate strokes & don't even think about
it; it's personal firmware at this point.

Gary


At 01:23 PM 6/17/2009, Meyer, Gregory J wrote:

>David, I think the issue is that unlike other programs, SPSS 17 (and
>17.02) requires that you continue to hold the Alt key to keep the menu
>activated while submitting another key. In other programs (including
>SPSS 15) just clicking the Alt key activates the menu and it stays
>activated until the next key is pressed. This may seem like a small
>issue, but I strongly prefer to use keyboard commands over the mouse and
>given that 17 doesn't work like all the other programs I use, I continue
>to use v15 for almost all of my data analysis.
>
>Greg
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>SPSS Support
>Sent: Wednesday, June 17, 2009 2:00 PM
>To: [hidden email]
>Subject: Re: Accessing Menu Bar
>
>Hi Gary,
>  I've tested the Alt-FS successfully in versions 15, 16, and 17. Which
>version of Statistics and which operating system are you running now?
>If you just hit Alt-F, does the File menu appear?
>If the file hasn't been changed since your last save, the Save item will
>be greyed out when you do open the File menu and the file won't be
>saved. However, when I use ALT-FS in this situation, the program doesn't
>beep at me or insert characters in the data cell.
>
>David Matheson
>SPSS Statistical Support
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>Gary Rosin
>Sent: Tuesday, June 16, 2009 3:58 PM
>To: [hidden email]
>Subject: Accessing Menu Bar
>
>This is just a complaint.  A constant minor irritant in SPSS/PASW
>is that it does not use the standard Alt key Windows protocol for
>accessing the menu bar.  Way back to Word for MS-Dos, I got
>used to using, say Alt, F, S for "F)ile S)ave, instead of Ctrl+s.
>SPSS beeps at me when I try that, then inserts characters in the
>active datacell.
>
>=====================
>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
>
>=====================
>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
>
>=====================
>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

=====================
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: Accessing Menu Bar

SPSS Support
Thanks for the clarification, Gary and Greg,
   Once the File menu is opened with Alt-F, I do have to hold the Alt key down while pressing the S to enact the save. So far, other operations that we've tested within the File menu (Export, Print, Save As, Rename Dataset) can be enacted by keystrokes without still holding the Alt key down. We have filed a bug with SPSS Development to correct the need to hold the Alt key while pressing S when the File menu opens. We'll also test other menu keystroke combinations. I don't have an estimate for the fix release at this point.

David Matheson
SPSS Statistical Support

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Gary Rosin
Sent: Wednesday, June 17, 2009 2:22 PM
To: [hidden email]
Subject: Re: Accessing Menu Bar

That's what it is, I use separate strokes & don't even think about
it; it's personal firmware at this point.

Gary


At 01:23 PM 6/17/2009, Meyer, Gregory J wrote:

>David, I think the issue is that unlike other programs, SPSS 17 (and
>17.02) requires that you continue to hold the Alt key to keep the menu
>activated while submitting another key. In other programs (including
>SPSS 15) just clicking the Alt key activates the menu and it stays
>activated until the next key is pressed. This may seem like a small
>issue, but I strongly prefer to use keyboard commands over the mouse and
>given that 17 doesn't work like all the other programs I use, I continue
>to use v15 for almost all of my data analysis.
>
>Greg
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>SPSS Support
>Sent: Wednesday, June 17, 2009 2:00 PM
>To: [hidden email]
>Subject: Re: Accessing Menu Bar
>
>Hi Gary,
>  I've tested the Alt-FS successfully in versions 15, 16, and 17. Which
>version of Statistics and which operating system are you running now?
>If you just hit Alt-F, does the File menu appear?
>If the file hasn't been changed since your last save, the Save item will
>be greyed out when you do open the File menu and the file won't be
>saved. However, when I use ALT-FS in this situation, the program doesn't
>beep at me or insert characters in the data cell.
>
>David Matheson
>SPSS Statistical Support
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>Gary Rosin
>Sent: Tuesday, June 16, 2009 3:58 PM
>To: [hidden email]
>Subject: Accessing Menu Bar
>
>This is just a complaint.  A constant minor irritant in SPSS/PASW
>is that it does not use the standard Alt key Windows protocol for
>accessing the menu bar.  Way back to Word for MS-Dos, I got
>used to using, say Alt, F, S for "F)ile S)ave, instead of Ctrl+s.
>SPSS beeps at me when I try that, then inserts characters in the
>active datacell.
>
>=====================
>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
>
>=====================
>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
>
>=====================
>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

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

=====================
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: Accessing Menu Bar

Meyer, Gregory J
Re: Accessing Menu Bar
David, thanks for checking this further. I wasn't fully clear. The issue is not what happens after F(ile) is activated. I actually had not noticed that you needed to hold Alt+F while hitting S(ave). The issue is having to hold Alt to activate anything on the main menu; i.e., F(ile) or E(dit) or D(ata), etc. Other programs only require that you click Alt to activate the main menu otions. In other words, SPSS 17 requires Alt+F, Alt+E, Alt+D, etc., but SPSS 15 and all other programs I know use Alt, F; Alt, E; Alt, D; etc. I hope that makes more sense.
 
Greg


From: SPSSX(r) Discussion on behalf of SPSS Support
Sent: Wed 6/17/2009 9:28 PM
To: [hidden email]
Subject: Re: Accessing Menu Bar

Thanks for the clarification, Gary and Greg,
   Once the File menu is opened with Alt-F, I do have to hold the Alt key down while pressing the S to enact the save. So far, other operations that we've tested within the File menu (Export, Print, Save As, Rename Dataset) can be enacted by keystrokes without still holding the Alt key down. We have filed a bug with SPSS Development to correct the need to hold the Alt key while pressing S when the File menu opens. We'll also test other menu keystroke combinations. I don't have an estimate for the fix release at this point.

David Matheson
SPSS Statistical Support

-----Original Message-----
From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Gary Rosin
Sent: Wednesday, June 17, 2009 2:22 PM
To: [hidden email]
Subject: Re: Accessing Menu Bar

That's what it is, I use separate strokes & don't even think about
it; it's personal firmware at this point.

Gary


At 01:23 PM 6/17/2009, Meyer, Gregory J wrote:


>David, I think the issue is that unlike other programs, SPSS 17 (and
>17.02) requires that you continue to hold the Alt key to keep the menu
>activated while submitting another key. In other programs (including
>SPSS 15) just clicking the Alt key activates the menu and it stays
>activated until the next key is pressed. This may seem like a small
>issue, but I strongly prefer to use keyboard commands over the mouse and
>given that 17 doesn't work like all the other programs I use, I continue
>to use v15 for almost all of my data analysis.
>
>Greg
>
>-----Original Message-----
>From: SPSSX(r) Discussion [[hidden email]] On Behalf Of
>SPSS Support
>Sent: Wednesday, June 17, 2009 2:00 PM
>To: [hidden email]
>Subject: Re: Accessing Menu Bar
>
>Hi Gary,
>  I've tested the Alt-FS successfully in versions 15, 16, and 17. Which
>version of Statistics and which operating system are you running now?
>If you just hit Alt-F, does the File menu appear?
>If the file hasn't been changed since your last save, the Save item will
>be greyed out when you do open the File menu and the file won't be
>saved. However, when I use ALT-FS in this situation, the program doesn't
>beep at me or insert characters in the data cell.
>
>David Matheson
>SPSS Statistical Support
>
>-----Original Message-----
>From: SPSSX(r) Discussion [[hidden email]] On Behalf Of
>Gary Rosin
>Sent: Tuesday, June 16, 2009 3:58 PM
>To: [hidden email]
>Subject: Accessing Menu Bar
>
>This is just a complaint.  A constant minor irritant in SPSS/PASW
>is that it does not use the standard Alt key Windows protocol for
>accessing the menu bar.  Way back to Word for MS-Dos, I got
>used to using, say Alt, F, S for "F)ile S)ave, instead of Ctrl+s.
>SPSS beeps at me when I try that, then inserts characters in the
>active datacell.
>
>=====================
>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
>
>=====================
>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
>
>=====================
>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

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

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

setting marker color by value

Mark A Davenport MADAVENP
In reply to this post by SPSS Support

All,

Before I try to digest the entire 141 of the GPL manual, I thought I would ask:  Does anyone have first-hand knowledge of the GPL commands that would allow one to have different marker colors within a single scatterplot based on the group the marker represents?

I have a scatterplot that shows the mean gpas from 65 different courses in 8 different academic departments.  The x-axis is the GPA mean for the 2008-09 academic year, y- is the GPA mean for the 1998-99 academic year.  I have aggregated the main dataset to create a smaller dataset with just the means for the 2 years, the course number, the course department.  I plot the means on the 2 axes and add the course name to the marker using the syntax below.  I could get a cleaner look if I could also give the mmarkers a different color based on the dept the course is in.  Ideas?

GGRAPH
  /GRAPHDATASET NAME="gds" VARIABLES=TBL_CRS_NUMB_NO_WI ay199899 ay200809
    MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("gds"))
  DATA: name=col(source(s), name("TBL_CRS_NUMB_NO_WI"), unit.category())
  DATA: xVar=col(source(s), name("ay199899"))
  DATA: yVar=col(source(s), name("ay200809"))
  COORD: rect(dim(1,2))
  SCALE: linear(dim(1), origin(0))
  SCALE: linear(dim(2), origin(0))
  GUIDE: axis(dim(1))
  GUIDE: axis(dim(2))
  ELEMENT: point(position(xVar*yVar), color.interior(color.black),label(name))
END GPL.

***************************************************************************************************************************************************************
Mark A. Davenport Ph.D.
Senior Research Analyst
Office of Institutional Research
The University of North Carolina at Greensboro
336.256.0395
[hidden email]

'An approximate answer to the right question is worth a good deal more than an exact answer to an approximate question.' --a paraphrase of J. W. Tukey (1962)


Reply | Threaded
Open this post in threaded view
|

Re: setting marker color by value

ViAnn Beadle

Use the chart builder to build a grouped scatterplot using the gallery and look at the GPL it generates. What’ll you see is that the color function takes the grouping variable as it’s argument (i.e., label(TBL_CRS_NUMB_NO_WI)). Also take a look at the grouped scatterplot example in the manual.

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Mark A Davenport MADAVENP
Sent: Friday, June 19, 2009 8:57 AM
To: [hidden email]
Subject: setting marker color by value

 


All,

Before I try to digest the entire 141 of the GPL manual, I thought I would ask:  Does anyone have first-hand knowledge of the GPL commands that would allow one to have different marker colors within a single scatterplot based on the group the marker represents?

I have a scatterplot that shows the mean gpas from 65 different courses in 8 different academic departments.  The x-axis is the GPA mean for the 2008-09 academic year, y- is the GPA mean for the 1998-99 academic year.  I have aggregated the main dataset to create a smaller dataset with just the means for the 2 years, the course number, the course department.  I plot the means on the 2 axes and add the course name to the marker using the syntax below.  I could get a cleaner look if I could also give the mmarkers a different color based on the dept the course is in.  Ideas?

GGRAPH
  /GRAPHDATASET NAME="gds" VARIABLES=TBL_CRS_NUMB_NO_WI ay199899 ay200809
    MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("gds"))
  DATA: name=col(source(s), name("TBL_CRS_NUMB_NO_WI"), unit.category())
  DATA: xVar=col(source(s), name("ay199899"))
  DATA: yVar=col(source(s), name("ay200809"))
  COORD: rect(dim(1,2))
  SCALE: linear(dim(1), origin(0))
  SCALE: linear(dim(2), origin(0))
  GUIDE: axis(dim(1))
  GUIDE: axis(dim(2))
  ELEMENT: point(position(xVar*yVar), color.interior(color.black),label(name))
END GPL.

***************************************************************************************************************************************************************
Mark A. Davenport Ph.D.
Senior Research Analyst
Office of Institutional Research
The University of North Carolina at Greensboro
336.256.0395
[hidden email]

'An approximate answer to the right question is worth a good deal more than an exact answer to an approximate question.' --a paraphrase of J. W. Tukey (1962)

Reply | Threaded
Open this post in threaded view
|

Re: setting marker color by value

Art Kendall
In reply to this post by Mark A Davenport MADAVENP
I am not up to speed with GPL but this is what is generated via chartbuilder  when I drag a categorical variable into the box that says "set color by".
*this uses the example file from the folder that comes with SPSS and is misnamed "samples".
GET
  FILE='C:\Program Files (x86)\SPSSInc\Statistics17\Samples\English\accidents.sav'.
DATASET ACTIVATE DataSet2.
* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=pop accid agecat MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: pop=col(source(s), name("pop"))
  DATA: accid=col(source(s), name("accid"))
  DATA: agecat=col(source(s), name("agecat"), unit.category())
  GUIDE: axis(dim(1), label("Population at risk"))
  GUIDE: axis(dim(2), label("Accidents"))
  GUIDE: legend(aesthetic(aesthetic.color.exterior), label("Age category"))
  SCALE: cat(aesthetic(aesthetic.color.exterior), include("1", "2", "3"))
  ELEMENT: point(position(pop*accid), color.exterior(agecat))
END GPL.

Art Kendall
Social Research Consultants

Mark A Davenport MADAVENP wrote:

All,

Before I try to digest the entire 141 of the GPL manual, I thought I would ask:  Does anyone have first-hand knowledge of the GPL commands that would allow one to have different marker colors within a single scatterplot based on the group the marker represents?

I have a scatterplot that shows the mean gpas from 65 different courses in 8 different academic departments.  The x-axis is the GPA mean for the 2008-09 academic year, y- is the GPA mean for the 1998-99 academic year.  I have aggregated the main dataset to create a smaller dataset with just the means for the 2 years, the course number, the course department.  I plot the means on the 2 axes and add the course name to the marker using the syntax below.  I could get a cleaner look if I could also give the mmarkers a different color based on the dept the course is in.  Ideas?

GGRAPH
  /GRAPHDATASET NAME="gds" VARIABLES=TBL_CRS_NUMB_NO_WI ay199899 ay200809
    MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("gds"))
  DATA: name=col(source(s), name("TBL_CRS_NUMB_NO_WI"), unit.category())
  DATA: xVar=col(source(s), name("ay199899"))
  DATA: yVar=col(source(s), name("ay200809"))
  COORD: rect(dim(1,2))
  SCALE: linear(dim(1), origin(0))
  SCALE: linear(dim(2), origin(0))
  GUIDE: axis(dim(1))
  GUIDE: axis(dim(2))
  ELEMENT: point(position(xVar*yVar), color.interior(color.black),label(name))
END GPL.

***************************************************************************************************************************************************************
Mark A. Davenport Ph.D.
Senior Research Analyst
Office of Institutional Research
The University of North Carolina at Greensboro
336.256.0395
[hidden email]

'An approximate answer to the right question is worth a good deal more than an exact answer to an approximate question.' --a paraphrase of J. W. Tukey (1962)


Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: setting marker color by value

Mark A Davenport MADAVENP
In reply to this post by ViAnn Beadle

AHA!

Set color as 'DEPT' and Point ID label as 'TBL_CRS_NUMB'.  I hadn't ever used this POINT ID box before (new to 17, I guess).  NICE!  
You folks are going to make me look SO good.

Mark

***************************************************************************************************************************************************************
Mark A. Davenport Ph.D.
Senior Research Analyst
Office of Institutional Research
The University of North Carolina at Greensboro
336.256.0395
[hidden email]

'An approximate answer to the right question is worth a good deal more than an exact answer to an approximate question.' --a paraphrase of J. W. Tukey (1962)





ViAnn Beadle <[hidden email]>
Sent by: "SPSSX(r) Discussion" <[hidden email]>

06/19/2009 11:08 AM

Please respond to
ViAnn Beadle <[hidden email]>

To
[hidden email]
cc
Subject
Re: setting marker color by value





Use the chart builder to build a grouped scatterplot using the gallery and look at the GPL it generates. What’ll you see is that the color function takes the grouping variable as it’s argument (i.e., label(TBL_CRS_NUMB_NO_WI)). Also take a look at the grouped scatterplot example in the manual.
 
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Mark A Davenport MADAVENP
Sent:
Friday, June 19, 2009 8:57 AM
To:
[hidden email]
Subject:
setting marker color by value

 

All,


Before I try to digest the entire 141 of the GPL manual, I thought I would ask:  Does anyone have first-hand knowledge of the GPL commands that would allow one to have different marker colors within a single scatterplot based on the group the marker represents?


I have a scatterplot that shows the mean gpas from 65 different courses in 8 different academic departments.  The x-axis is the GPA mean for the 2008-09 academic year, y- is the GPA mean for the 1998-99 academic year.  I have aggregated the main dataset to create a smaller dataset with just the means for the 2 years, the course number, the course department.  I plot the means on the 2 axes and add the course name to the marker using the syntax below.  I could get a cleaner look if I could also give the mmarkers a different color based on the dept the course is in.  Ideas?


GGRAPH

 /GRAPHDATASET NAME="gds" VARIABLES=TBL_CRS_NUMB_NO_WI ay199899 ay200809

   MISSING=LISTWISE REPORTMISSING=NO

 /GRAPHSPEC SOURCE=INLINE.

BEGIN GPL

 SOURCE: s=userSource(id("gds"))

 DATA: name=col(source(s), name("TBL_CRS_NUMB_NO_WI"), unit.category())

 DATA: xVar=col(source(s), name("ay199899"))

 DATA: yVar=col(source(s), name("ay200809"))

 COORD: rect(dim(1,2))

 SCALE: linear(dim(1), origin(0))

 SCALE: linear(dim(2), origin(0))

 GUIDE: axis(dim(1))

 GUIDE: axis(dim(2))

 ELEMENT: point(position(xVar*yVar), color.interior(color.black),label(name))

END GPL.


***************************************************************************************************************************************************************
Mark A. Davenport Ph.D.
Senior Research Analyst
Office of Institutional Research
The University of North Carolina at Greensboro
336.256.0395
[hidden email]

'An approximate answer to the right question is worth a good deal more than an exact answer to an approximate question.' --a paraphrase of J. W. Tukey (1962)

Reply | Threaded
Open this post in threaded view
|

Re: Accessing Menu Bar

SPSS Support
In reply to this post by Meyer, Gregory J
Re: Accessing Menu Bar

Thanks, again, Greg. There is a bug filed to cover the need to hold down the Alt key to activate the main menu options. This is expected to be fixed in Statistics 18. There is a work-around in Statistics 16 and 17.

Open the Edit menu and choose Options.

In the General tab of the Options dialog, you’ll see a section on the left side titled “Windows”. There is a scroll bar for “Look and feel:”. The default Look and Feel is “SPSS Inc. Standard”. If you use the scroll bar to choose “Windows” as the Look and Feel and then click OK, you should find the Alt key functioning as in 15 to access the menu bar, i.e. without holding down the ALT key as you hit the other keystrokes in the sequence.

 

David Matheson

 

 


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Meyer, Gregory J
Sent: Wednesday, June 17, 2009 10:17 PM
To: [hidden email]
Subject: Re: Accessing Menu Bar

 

David, thanks for checking this further. I wasn't fully clear. The issue is not what happens after F(ile) is activated. I actually had not noticed that you needed to hold Alt+F while hitting S(ave). The issue is having to hold Alt to activate anything on the main menu; i.e., F(ile) or E(dit) or D(ata), etc. Other programs only require that you click Alt to activate the main menu otions. In other words, SPSS 17 requires Alt+F, Alt+E, Alt+D, etc., but SPSS 15 and all other programs I know use Alt, F; Alt, E; Alt, D; etc. I hope that makes more sense.

 

Greg

 


From: SPSSX(r) Discussion on behalf of SPSS Support
Sent: Wed 6/17/2009 9:28 PM
To: [hidden email]
Subject: Re: Accessing Menu Bar

Thanks for the clarification, Gary and Greg,
   Once the File menu is opened with Alt-F, I do have to hold the Alt key down while pressing the S to enact the save. So far, other operations that we've tested within the File menu (Export, Print, Save As, Rename Dataset) can be enacted by keystrokes without still holding the Alt key down. We have filed a bug with SPSS Development to correct the need to hold the Alt key while pressing S when the File menu opens. We'll also test other menu keystroke combinations. I don't have an estimate for the fix release at this point.

David Matheson
SPSS Statistical Support

-----Original Message-----
From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Gary Rosin
Sent: Wednesday, June 17, 2009 2:22 PM
To: [hidden email]
Subject: Re: Accessing Menu Bar

That's what it is, I use separate strokes & don't even think about
it; it's personal firmware at this point.

Gary


At 01:23 PM 6/17/2009, Meyer, Gregory J wrote:
>David, I think the issue is that unlike other programs, SPSS 17 (and
>17.02) requires that you continue to hold the Alt key to keep the menu
>activated while submitting another key. In other programs (including
>SPSS 15) just clicking the Alt key activates the menu and it stays
>activated until the next key is pressed. This may seem like a small
>issue, but I strongly prefer to use keyboard commands over the mouse and
>given that 17 doesn't work like all the other programs I use, I continue
>to use v15 for almost all of my data analysis.
>
>Greg
>
>-----Original Message-----
>From: SPSSX(r) Discussion [[hidden email]] On Behalf Of
>SPSS Support
>Sent: Wednesday, June 17, 2009 2:00 PM
>To: [hidden email]
>Subject: Re: Accessing Menu Bar
>
>Hi Gary,
>  I've tested the Alt-FS successfully in versions 15, 16, and 17. Which
>version of Statistics and which operating system are you running now?
>If you just hit Alt-F, does the File menu appear?
>If the file hasn't been changed since your last save, the Save item will
>be greyed out when you do open the File menu and the file won't be
>saved. However, when I use ALT-FS in this situation, the program doesn't
>beep at me or insert characters in the data cell.
>
>David Matheson
>SPSS Statistical Support
>
>-----Original Message-----
>From: SPSSX(r) Discussion [[hidden email]] On Behalf Of
>Gary Rosin
>Sent: Tuesday, June 16, 2009 3:58 PM
>To: [hidden email]
>Subject: Accessing Menu Bar
>
>This is just a complaint.  A constant minor irritant in SPSS/PASW
>is that it does not use the standard Alt key Windows protocol for
>accessing the menu bar.  Way back to Word for MS-Dos, I got
>used to using, say Alt, F, S for "F)ile S)ave, instead of Ctrl+s.
>SPSS beeps at me when I try that, then inserts characters in the
>active datacell.
>
>=====================
>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
>
>=====================
>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
>
>=====================
>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

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

=====================
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: Accessing Menu Bar

Meyer, Gregory J
Re: Accessing Menu Bar

Oh, that’s fantastic. And such a simple resolution. Thanks David.

 

Greg

 

From: SPSS Support [mailto:[hidden email]]
Sent: Friday, June 19, 2009 11:46 AM
To: Meyer, Gregory J; [hidden email]
Subject: RE: Re: Accessing Menu Bar

 

Thanks, again, Greg. There is a bug filed to cover the need to hold down the Alt key to activate the main menu options. This is expected to be fixed in Statistics 18. There is a work-around in Statistics 16 and 17.

Open the Edit menu and choose Options.

In the General tab of the Options dialog, you’ll see a section on the left side titled “Windows”. There is a scroll bar for “Look and feel:”. The default Look and Feel is “SPSS Inc. Standard”. If you use the scroll bar to choose “Windows” as the Look and Feel and then click OK, you should find the Alt key functioning as in 15 to access the menu bar, i.e. without holding down the ALT key as you hit the other keystrokes in the sequence.

 

David Matheson

 

 


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Meyer, Gregory J
Sent: Wednesday, June 17, 2009 10:17 PM
To: [hidden email]
Subject: Re: Accessing Menu Bar

 

David, thanks for checking this further. I wasn't fully clear. The issue is not what happens after F(ile) is activated. I actually had not noticed that you needed to hold Alt+F while hitting S(ave). The issue is having to hold Alt to activate anything on the main menu; i.e., F(ile) or E(dit) or D(ata), etc. Other programs only require that you click Alt to activate the main menu otions. In other words, SPSS 17 requires Alt+F, Alt+E, Alt+D, etc., but SPSS 15 and all other programs I know use Alt, F; Alt, E; Alt, D; etc. I hope that makes more sense.

 

Greg

 


From: SPSSX(r) Discussion on behalf of SPSS Support
Sent: Wed 6/17/2009 9:28 PM
To: [hidden email]
Subject: Re: Accessing Menu Bar

Thanks for the clarification, Gary and Greg,
   Once the File menu is opened with Alt-F, I do have to hold the Alt key down while pressing the S to enact the save. So far, other operations that we've tested within the File menu (Export, Print, Save As, Rename Dataset) can be enacted by keystrokes without still holding the Alt key down. We have filed a bug with SPSS Development to correct the need to hold the Alt key while pressing S when the File menu opens. We'll also test other menu keystroke combinations. I don't have an estimate for the fix release at this point.

David Matheson
SPSS Statistical Support

-----Original Message-----
From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Gary Rosin
Sent: Wednesday, June 17, 2009 2:22 PM
To: [hidden email]
Subject: Re: Accessing Menu Bar

That's what it is, I use separate strokes & don't even think about
it; it's personal firmware at this point.

Gary


At 01:23 PM 6/17/2009, Meyer, Gregory J wrote:
>David, I think the issue is that unlike other programs, SPSS 17 (and
>17.02) requires that you continue to hold the Alt key to keep the menu
>activated while submitting another key. In other programs (including
>SPSS 15) just clicking the Alt key activates the menu and it stays
>activated until the next key is pressed. This may seem like a small
>issue, but I strongly prefer to use keyboard commands over the mouse and
>given that 17 doesn't work like all the other programs I use, I continue
>to use v15 for almost all of my data analysis.
>
>Greg
>
>-----Original Message-----
>From: SPSSX(r) Discussion [[hidden email]] On Behalf Of
>SPSS Support
>Sent: Wednesday, June 17, 2009 2:00 PM
>To: [hidden email]
>Subject: Re: Accessing Menu Bar
>
>Hi Gary,
>  I've tested the Alt-FS successfully in versions 15, 16, and 17. Which
>version of Statistics and which operating system are you running now?
>If you just hit Alt-F, does the File menu appear?
>If the file hasn't been changed since your last save, the Save item will
>be greyed out when you do open the File menu and the file won't be
>saved. However, when I use ALT-FS in this situation, the program doesn't
>beep at me or insert characters in the data cell.
>
>David Matheson
>SPSS Statistical Support
>
>-----Original Message-----
>From: SPSSX(r) Discussion [[hidden email]] On Behalf Of
>Gary Rosin
>Sent: Tuesday, June 16, 2009 3:58 PM
>To: [hidden email]
>Subject: Accessing Menu Bar
>
>This is just a complaint.  A constant minor irritant in SPSS/PASW
>is that it does not use the standard Alt key Windows protocol for
>accessing the menu bar.  Way back to Word for MS-Dos, I got
>used to using, say Alt, F, S for "F)ile S)ave, instead of Ctrl+s.
>SPSS beeps at me when I try that, then inserts characters in the
>active datacell.
>
>=====================
>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
>
>=====================
>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
>
>=====================
>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

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

=====================
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: setting marker color by value

ViAnn Beadle
In reply to this post by Art Kendall

color.exterior(agecat) sets the border of the symbol to the values of agecat. This is a categorical variable with the three values. The order of the colors is set by the built in chart template which can be tinkered with via the Options dialog.

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Art Kendall
Sent: Friday, June 19, 2009 9:17 AM
To: [hidden email]
Subject: Re: setting marker color by value

 

I am not up to speed with GPL but this is what is generated via chartbuilder  when I drag a categorical variable into the box that says "set color by".
*this uses the example file from the folder that comes with SPSS and is misnamed "samples".
GET
  FILE='C:\Program Files (x86)\SPSSInc\Statistics17\Samples\English\accidents.sav'.
DATASET ACTIVATE DataSet2.
* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=pop accid agecat MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: pop=col(source(s), name("pop"))
  DATA: accid=col(source(s), name("accid"))
  DATA: agecat=col(source(s), name("agecat"), unit.category())
  GUIDE: axis(dim(1), label("Population at risk"))
  GUIDE: axis(dim(2), label("Accidents"))
  GUIDE: legend(aesthetic(aesthetic.color.exterior), label("Age category"))
  SCALE: cat(aesthetic(aesthetic.color.exterior), include("1", "2", "3"))
  ELEMENT: point(position(pop*accid), color.exterior(agecat))
END GPL.

Art Kendall
Social Research Consultants

Mark A Davenport MADAVENP wrote:


All,

Before I try to digest the entire 141 of the GPL manual, I thought I would ask:  Does anyone have first-hand knowledge of the GPL commands that would allow one to have different marker colors within a single scatterplot based on the group the marker represents?

I have a scatterplot that shows the mean gpas from 65 different courses in 8 different academic departments.  The x-axis is the GPA mean for the 2008-09 academic year, y- is the GPA mean for the 1998-99 academic year.  I have aggregated the main dataset to create a smaller dataset with just the means for the 2 years, the course number, the course department.  I plot the means on the 2 axes and add the course name to the marker using the syntax below.  I could get a cleaner look if I could also give the mmarkers a different color based on the dept the course is in.  Ideas?

GGRAPH
  /GRAPHDATASET NAME="gds" VARIABLES=TBL_CRS_NUMB_NO_WI ay199899 ay200809
    MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("gds"))
  DATA: name=col(source(s), name("TBL_CRS_NUMB_NO_WI"), unit.category())
  DATA: xVar=col(source(s), name("ay199899"))
  DATA: yVar=col(source(s), name("ay200809"))
  COORD: rect(dim(1,2))
  SCALE: linear(dim(1), origin(0))
  SCALE: linear(dim(2), origin(0))
  GUIDE: axis(dim(1))
  GUIDE: axis(dim(2))
  ELEMENT: point(position(xVar*yVar), color.interior(color.black),label(name))
END GPL.

***************************************************************************************************************************************************************
Mark A. Davenport Ph.D.
Senior Research Analyst
Office of Institutional Research
The University of North Carolina at Greensboro
336.256.0395
[hidden email]

'An approximate answer to the right question is worth a good deal more than an exact answer to an approximate question.' --a paraphrase of J. W. Tukey (1962)