|
Just had a quick look through the demo files inside SPSS (C:\Program Files\IBM\SPSS\Statistics\24\Samples\English) to see if there was anything I could use for tutorials and found a possibility survey_sample.sav. On inspection I found a derived variable agecat which should be integer, but has 2 superflous decimal places, probably the result of COMPUTE and RECODE. Was this deliberate or an oversight? If one of my students had done this, I would have deducted marks for not using FORMATS agecat (f1.0).
In England we would say "Under 25" rather than "Less than 25". John F Hall MA (Cantab) Dip Ed (Dunelm) [Retired academic survey researcher] Email: [hidden email] Website: Journeys in Survey Research Course: Survey Analysis Workshop (SPSS) Research: Subjective Social Indicators (Quality of Life) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Administrator
|
When life gives you lemons, John, make lemonade. You can use this as an
opportunity to demonstrate the FORMATS command, and to discuss the distinction between VALUE LABELS and ADD VALUE LABELS. You could also demonstrate the use of LO and HI in RECODE, and show that after a condition in a RECODE command has been met, no further conditions are checked. E.g., notice how the RECODE command below works, despite using THRU HI for each of the 6 values. It works because the conditions are ordered correctly. * Change path as needed on next line. GET FILE "C:\SPSSdata\survey_sample.sav". DESCRIPTIVES age. FREQUENCIES agecat. * Show how one could generate the agecat variable via RECODE. * Demonstrate that after a condition is met, no further conditions are checked. RECODE age (65 THRU HI = 6) (55 THRU HI = 5) (45 THRU HI = 4) (35 THRU HI = 3) (25 THRU HI = 2) (LO THRU HI = 1) INTO agecat2. FORMATS agecat agecat2 (F1). VALUE LABELS agecat2 1 "Under 25" 2 "25 to 34" 3 "35 to 44" 4 "45 to 54" 5 "55 to 64" 6 "65 or older" . ADD VALUE LABELS agecat 1 "Under 25". CROSSTABS agecat BY agecat2. John F Hall wrote > Just had a quick look through the demo files inside SPSS > > (C:\Program Files\IBM\SPSS\Statistics\24\Samples\English) > > to see if there was anything I could use for tutorials and found a > possibility survey_sample.sav. On inspection I found a derived variable > agecat which should be integer, but has 2 superflous decimal places, > probably the result of COMPUTE and RECODE. Was this deliberate or an > oversight? If one of my students had done this, I would have deducted > marks > for not using FORMATS agecat (f1.0). > > > agecat Age category > > > > > Frequency > > Percent > > Valid Percent > > Cumulative Percent > > > Valid > > 1.00 Less than 25 > > 242 > > 8.5 > > 8.6 > > 8.6 > > > 2.00 25 to 34 > > 627 > > 22.1 > > 22.2 > > 30.7 > > > 3.00 35 to 44 > > 679 > > 24.0 > > 24.0 > > 54.7 > > > 4.00 45 to 54 > > 481 > > 17.0 > > 17.0 > > 71.7 > > > 5.00 55 to 64 > > 320 > > 11.3 > > 11.3 > > 83.1 > > > 6.00 65 or older > > 479 > > 16.9 > > 16.9 > > 100.0 > > > Total > > 2828 > > 99.9 > > 100.0 > > > > > Missing > > System > > 4 > > 0.1 > > > > > > > Total > > 2832 > > 100.0 > > > > > > > > In England we would say "Under 25" rather than "Less than 25". > > > > > > John F Hall MA (Cantab) Dip Ed (Dunelm) > > [Retired academic survey researcher] > > > > Email: > johnfhall@ > <mailto: > johnfhall@ > > > > Website: Journeys in Survey Research > <http://surveyresearch.weebly.com/> > > > Course: Survey Analysis Workshop (SPSS) > <http://surveyresearch.weebly.com/1-survey-analysis-workshop-spss.html> > > Research: Subjective Social Indicators (Quality of Life) > <http://surveyresearch.weebly.com/3-subjective-social-indicators-quality-of- > life.html> > > > > > ===================== > 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. -- Sent from: http://spssx-discussion.1045642.n5.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
--
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/). |
|
In reply to this post by John F Hall
I probably created that one, and I can't do anything about it now. On Wed, May 23, 2018 at 11:10 AM, John F Hall <[hidden email]> wrote:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
In reply to this post by Bruce Weaver
Bruce
Rick has already pleaded guilty for the SPSS example. It looks like a genuine rather than artificial data set, but what was the source and when was it conducted? When I looked at your syntax it reminded me of some RECODE commands written by Jim Ring 40 years ago in the days before RECODE ..into.. something like: COMPUTE agegroup = age. RECODE agegroup (16 thru 25 = 1)(25 thru 45 =2)(45 thru 65=3(65 thru hi =4). I queried it, but he rightly claimed that it would work correctly. I had never seen the same thing with thru HI. Also first time I've seen ADD VARIABLE LABELS to over-write an existing label. I've only ever used it to label new values (created after Jon's Python code to locate concordant and discordant pairs: too complex to explain) without deleting the other labels. Bit like living in France: you learn a new word/trick every day. Another pedantic instruction is to add 0.5 to age when calculating statistics (someone aged 51 is somewhere between 51 and 52) but no-one ever does, so they are always out by 6 months. John John F Hall MA (Cantab) Dip Ed (Dunelm) [Retired academic survey researcher] Email: [hidden email] Website: Journeys in Survey Research Course: Survey Analysis Workshop (SPSS) Research: Subjective Social Indicators (Quality of Life) -----Original Message----- From: SPSSX(r) Discussion <[hidden email]> On Behalf Of Bruce Weaver Sent: 23 May 2018 19:36 To: [hidden email] Subject: Re: Superfluous decimals in demo file survey_sample.sav When life gives you lemons, John, make lemonade. You can use this as an opportunity to demonstrate the FORMATS command, and to discuss the distinction between VALUE LABELS and ADD VALUE LABELS. You could also demonstrate the use of LO and HI in RECODE, and show that after a condition in a RECODE command has been met, no further conditions are checked. E.g., notice how the RECODE command below works, despite using THRU HI for each of the 6 values. It works because the conditions are ordered correctly. * Change path as needed on next line. GET FILE "C:\SPSSdata\survey_sample.sav". DESCRIPTIVES age. FREQUENCIES agecat. * Show how one could generate the agecat variable via RECODE. * Demonstrate that after a condition is met, no further conditions are checked. RECODE age (65 THRU HI = 6) (55 THRU HI = 5) (45 THRU HI = 4) (35 THRU HI = 3) (25 THRU HI = 2) (LO THRU HI = 1) INTO agecat2. FORMATS agecat agecat2 (F1). VALUE LABELS agecat2 1 "Under 25" 2 "25 to 34" 3 "35 to 44" 4 "45 to 54" 5 "55 to 64" 6 "65 or older" . ADD VALUE LABELS agecat 1 "Under 25". CROSSTABS agecat BY agecat2. John F Hall wrote > Just had a quick look through the demo files inside SPSS > > (C:\Program Files\IBM\SPSS\Statistics\24\Samples\English) > > to see if there was anything I could use for tutorials and found a > possibility survey_sample.sav. On inspection I found a derived > variable agecat which should be integer, but has 2 superflous decimal > places, probably the result of COMPUTE and RECODE. Was this > deliberate or an oversight? If one of my students had done this, I > would have deducted marks for not using FORMATS agecat (f1.0). > > > agecat Age category > > > > > Frequency > > Percent > > Valid Percent > > Cumulative Percent > > > Valid > > 1.00 Less than 25 > > 242 > > 8.5 > > 8.6 > > 8.6 > > > 2.00 25 to 34 > > 627 > > 22.1 > > 22.2 > > 30.7 > > > 3.00 35 to 44 > > 679 > > 24.0 > > 24.0 > > 54.7 > > > 4.00 45 to 54 > > 481 > > 17.0 > > 17.0 > > 71.7 > > > 5.00 55 to 64 > > 320 > > 11.3 > > 11.3 > > 83.1 > > > 6.00 65 or older > > 479 > > 16.9 > > 16.9 > > 100.0 > > > Total > > 2828 > > 99.9 > > 100.0 > > > > > Missing > > System > > 4 > > 0.1 > > > > > > > Total > > 2832 > > 100.0 > > > > > > > > In England we would say "Under 25" rather than "Less than 25". > > > > > > John F Hall MA (Cantab) Dip Ed (Dunelm) > > [Retired academic survey researcher] > > > > Email: > johnfhall@ > <mailto: > johnfhall@ > > > > Website: Journeys in Survey Research > <http://surveyresearch.weebly.com/> > > > Course: Survey Analysis Workshop (SPSS) > <http://surveyresearch.weebly.com/1-survey-analysis-workshop-spss.h > tml> > > Research: Subjective Social Indicators (Quality of Life) > <http://surveyresearch.weebly.com/3-subjective-social-indicators-qu > ality-of- > life.html> > > > > > ===================== > 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. -- Sent from: http://spssx-discussion.1045642.n5.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 ===================== 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 |
|
While that particular dataset is based on "real" data, it has been substantially altered: survey_sample.sav. This data file contains survey data, including demographic data and various attitude measures. It is based on a subset of variables from the 1998 NORC General Social Survey, although some data values have been modified and additional fictitious variables have been added for demonstration purposes. On Thu, May 24, 2018 at 3:35 AM, John F Hall <[hidden email]> wrote: Bruce |
|
Administrator
|
In reply to this post by John F Hall
To complete the example of using THRU HI in RECODE, I guess I should have
included another RECODE with the parenthetical bits in the opposite order. Try the RECODE INTO agecat3 section below: * Show how one could generate the agecat variable via RECODE. * Demonstrate that the order is important. RECODE age (65 THRU HI = 6) (55 THRU HI = 5) (45 THRU HI = 4) (35 THRU HI = 3) (25 THRU HI = 2) (LO THRU HI = 1) INTO agecat2. RECODE age (LO THRU HI = 1) (25 THRU HI = 2) (35 THRU HI = 3) (45 THRU HI = 4) (55 THRU HI = 5) (65 THRU HI = 6) INTO agecat3. FORMATS agecat agecat2 agecat3 (F1). VALUE LABELS agecat2 1 "Under 25" 2 "25 to 34" 3 "35 to 44" 4 "45 to 54" 5 "55 to 64" 6 "65 or older" . ADD VALUE LABELS agecat 1 "Under 25". CROSSTABS agecat BY agecat2 agecat3. Because LO THRU HI captures all cases, everyone with a valid age ends up with agecat3 = 1. John F Hall wrote > Bruce > > Rick has already pleaded guilty for the SPSS example. It looks like a > genuine rather than artificial data set, but what was the source and when > was it conducted? When I looked at your syntax it reminded me of some > RECODE commands written by Jim Ring 40 years ago in the days before RECODE > ..into.. > something like: > > COMPUTE agegroup = age. > RECODE agegroup (16 thru 25 = 1)(25 thru 45 =2)(45 thru 65=3(65 thru hi > =4). > > I queried it, but he rightly claimed that it would work correctly. I had > never seen the same thing with thru HI. Also first time I've seen ADD > VARIABLE LABELS to over-write an existing label. I've only ever used it > to > label new values (created after Jon's Python code to locate concordant and > discordant pairs: too complex to explain) without deleting the other > labels. > > Bit like living in France: you learn a new word/trick every day. > > Another pedantic instruction is to add 0.5 to age when calculating > statistics (someone aged 51 is somewhere between 51 and 52) but no-one > ever > does, so they are always out by 6 months. > > John > > John F Hall MA (Cantab) Dip Ed (Dunelm) > [Retired academic survey researcher] > > Email: > johnfhall@ > > Website: Journeys in Survey Research > Course: Survey Analysis Workshop (SPSS) > Research: Subjective Social Indicators (Quality of Life) > > -----Original Message----- > From: SPSSX(r) Discussion < > SPSSX-L@.UGA > > On Behalf Of Bruce > Weaver > Sent: 23 May 2018 19:36 > To: > SPSSX-L@.UGA > Subject: Re: Superfluous decimals in demo file survey_sample.sav > > When life gives you lemons, John, make lemonade. You can use this as an > opportunity to demonstrate the FORMATS command, and to discuss the > distinction between VALUE LABELS and ADD VALUE LABELS. You could also > demonstrate the use of LO and HI in RECODE, and show that after a > condition > in a RECODE command has been met, no further conditions are checked. > E.g., > notice how the RECODE command below works, despite using THRU HI for each > of > the 6 values. It works because the conditions are ordered correctly. > > * Change path as needed on next line. > GET FILE "C:\SPSSdata\survey_sample.sav". > DESCRIPTIVES age. > FREQUENCIES agecat. > > * Show how one could generate the agecat variable via RECODE. > * Demonstrate that after a condition is met, no further conditions are > checked. > RECODE age > (65 THRU HI = 6) > (55 THRU HI = 5) > (45 THRU HI = 4) > (35 THRU HI = 3) > (25 THRU HI = 2) > (LO THRU HI = 1) INTO agecat2. > FORMATS agecat agecat2 (F1). > VALUE LABELS agecat2 > 1 "Under 25" > 2 "25 to 34" > 3 "35 to 44" > 4 "45 to 54" > 5 "55 to 64" > 6 "65 or older" > . > ADD VALUE LABELS agecat 1 "Under 25". > CROSSTABS agecat BY agecat2. > > > > > John F Hall wrote >> Just had a quick look through the demo files inside SPSS >> >> (C:\Program Files\IBM\SPSS\Statistics\24\Samples\English) >> >> to see if there was anything I could use for tutorials and found a >> possibility survey_sample.sav. On inspection I found a derived >> variable agecat which should be integer, but has 2 superflous decimal >> places, probably the result of COMPUTE and RECODE. Was this >> deliberate or an oversight? If one of my students had done this, I >> would have deducted marks for not using FORMATS agecat (f1.0). >> >> >> agecat Age category >> >> >> >> >> Frequency >> >> Percent >> >> Valid Percent >> >> Cumulative Percent >> >> >> Valid >> >> 1.00 Less than 25 >> >> 242 >> >> 8.5 >> >> 8.6 >> >> 8.6 >> >> >> 2.00 25 to 34 >> >> 627 >> >> 22.1 >> >> 22.2 >> >> 30.7 >> >> >> 3.00 35 to 44 >> >> 679 >> >> 24.0 >> >> 24.0 >> >> 54.7 >> >> >> 4.00 45 to 54 >> >> 481 >> >> 17.0 >> >> 17.0 >> >> 71.7 >> >> >> 5.00 55 to 64 >> >> 320 >> >> 11.3 >> >> 11.3 >> >> 83.1 >> >> >> 6.00 65 or older >> >> 479 >> >> 16.9 >> >> 16.9 >> >> 100.0 >> >> >> Total >> >> 2828 >> >> 99.9 >> >> 100.0 >> >> >> >> >> Missing >> >> System >> >> 4 >> >> 0.1 >> >> >> >> >> >> >> Total >> >> 2832 >> >> 100.0 >> >> >> >> >> >> >> >> In England we would say "Under 25" rather than "Less than 25". >> >> >> >> >> >> John F Hall MA (Cantab) Dip Ed (Dunelm) >> >> [Retired academic survey researcher] >> >> >> >> Email: > >> johnfhall@ > >> <mailto: > >> johnfhall@ > >> > >> >> Website: Journeys in Survey Research >> <http://surveyresearch.weebly.com/> >> >> >> Course: Survey Analysis Workshop (SPSS) >> <http://surveyresearch.weebly.com/1-survey-analysis-workshop-spss.h >> tml> >> >> Research: Subjective Social Indicators (Quality of Life) >> <http://surveyresearch.weebly.com/3-subjective-social-indicators-qu >> ality-of- >> life.html> >> >> >> >> >> ===================== >> 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 > bweaver@ > 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. > > -- > Sent from: http://spssx-discussion.1045642.n5.nabble.com/ > > ===================== > 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 > > ===================== > 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. -- Sent from: http://spssx-discussion.1045642.n5.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
--
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/). |
|
In reply to this post by Rick Oliver
Rick Perhaps it should be updated? It's the only data set which isn't geared to commercial and marketing ends, a long way from Nie, Hull and Jenkins (original blue manual) and Norusis (1987 and later editions). There really is no need for fictitious data: there are plenty of recent data sets available with variables suitable for all types of analysis. They even have Mixed Case labels, unlike NORC/GSS 2008 (see my commentary on the full 2008 NORC/GSS (http://surveyresearch.weebly.com/uploads/2/9/9/8/2998485/notes_on_full_gss_2008.pdf) But then I'm not trying for sales-person of the year, just trying to "teach sociologists how to count". As my old boss the late Dr Mark Abrams used to say, "If it's worth saying, you can say it with percentages." However, since "a picture is worth a thousand words" he'd be calling for charts as well as tables. John John F Hall MA (Cantab) Dip Ed (Dunelm) [Retired academic survey researcher] Email: [hidden email] Website: Journeys in Survey Research Course: Survey Analysis Workshop (SPSS) Research: Subjective Social Indicators (Quality of Life) From: Rick Oliver <[hidden email]> While that particular dataset is based on "real" data, it has been substantially altered: survey_sample.sav. This data file contains survey data, including demographic data and various attitude measures. It is based on a subset of variables from the 1998 NORC General Social Survey, although some data values have been modified and additional fictitious variables have been added for demonstration purposes. On Thu, May 24, 2018 at 3:35 AM, John F Hall <[hidden email]> wrote:
|
|
In reply to this post by John F Hall
I have changed the setting in SPSS to create new variables from the default
F8.2 format to F8.0 (Edit|Options|Data|Display format for new numeric variables). I most often create nominal or ordinal data so it suits me better but then I have to remember when I need to see decimals... /PRogman -- Sent from: http://spssx-discussion.1045642.n5.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 |
|
I hardly ever have string variables, and they are mostly from mainframe
days. I always convert them to numeric, usually with RECODE ...INTO for the older ones, but sometimes with AUTRECODE with stuff I work on today. These dta sets have usually been generated from surveys by someone else. I am likely to need something like this for different variables in different surveys. Can your syntax be incorporated into a macro so that all I have to do (outside your syntax) is enter the varlist and the value to be tabulated? Now that would be a really valuable tool. I'm no coder/programmer, just a humble survey researcher with some KDF9 Algol programming 50 years ago (8-hole paper tape input and output) to process and analyse a survey before SPSS came to the rescue. John F Hall MA (Cantab) Dip Ed (Dunelm) [Retired academic survey researcher] Email: [hidden email] Website: Journeys in Survey Research Course: Survey Analysis Workshop (SPSS) Research: Subjective Social Indicators (Quality of Life) -----Original Message----- From: SPSSX(r) Discussion <[hidden email]> On Behalf Of PRogman Sent: 26 May 2018 17:33 To: [hidden email] Subject: Re: Superfluous decimals in demo file survey_sample.sav I have changed the setting in SPSS to create new variables from the default F8.2 format to F8.0 (Edit|Options|Data|Display format for new numeric variables). I most often create nominal or ordinal data so it suits me better but then I have to remember when I need to see decimals... /PRogman -- Sent from: http://spssx-discussion.1045642.n5.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 ===================== 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 |
|
It would be easy to create a little program that would set the format to zero decimals for all or a list of numeric variables if the values were all integer. Anybody interested? On Sat, May 26, 2018 at 11:36 AM John F Hall <[hidden email]> wrote: I hardly ever have string variables, and they are mostly from mainframe -- |
|
Sure Jon, always like those "peckgrams" and this one in particular since have
a dataset that needs a lot done to it Tks Will ----- Will Statistical Services ============ [hidden email] http://home.earthlink.net/~z_statman/ Skype & Google Talk: zstatman ============ -- Sent from: http://spssx-discussion.1045642.n5.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
Will
Statistical Services ============ info.statman@earthlink.net http://home.earthlink.net/~z_statman/ ============ |
|
In reply to this post by John F Hall
Here is a version. Followed by examples using the survey_sample.sav dataset.
HTH, PRogman DEFINE !MRTable(PTitle !TOKENS(1) !DEFAULT('') /*Quoted string för procedure header */ /PTHide !TOKENS(1) !DEFAULT(0) /*Hide PT; 0=Visible, 1=Hidden */ /TTitle !TOKENS(1) !DEFAULT('"Multiple Response Table"') /*Quoted string for table header */ /TabVal !TOKENS(1) !DEFAULT(1) /*Dichotomy group tabulated value */ /MRVar !CMDEND /*List of variables to include in mrs */ ) PRESERVE. SET MESSAGES NONE RESULTS NONE ERRORS NONE. /*Remove to display MRSETS output */ *For future development. !LET !M = '$Var' MRSETS /MDGROUP NAME = !M CATEGORYLABELS = VARLABELS VARIABLES = !MRVar VALUE = !TabVal /DISPLAY NAME = [!M] . RESTORE. CTABLES /VLABELS VARIABLES = !M DISPLAY = NONE /TABLE !M [C] [COUNT 'Cases \n(n)' F8.0 ,COLPCT.COUNT 'Cases \n(%)' PCT8.1 ,TOTALS [COUNT F8.0 ] ] /CATEGORIES VARIABLES = !M ORDER=D KEY=COUNT EMPTY=INCLUDE TOTAL=YES POSITION=AFTER LABEL='N=100%' /TITLES TITLE = !TTitle CAPTION = !QUOTE(!CONCAT('Dichotomy group tabulated at value ', !TabVal )) 'More than 1 response per case allowed' . !IF ((!PTitle !NE '') !OR (!PTHide !EQ 1)) !THEN *If new procedure title specified or request to hide... !IF (!PTitle !NE '') !THEN !LET !P = !PTitle !ELSE !LET !P = !QUOTE('Custom Tables') !IFEND SPSSINC MODIFY OUTPUT TITLES /IF COMMAND = "CTABLES" PROCESS = PRECEDING /REPLACE ITEMS ITEMTITLE = !P /VISIBILITY VISIBLE = !IF (!PTHide !NE 1) !THEN ASIS !ELSE FALSE !IFEND /PAGEBREAKS BREAKBEFORETITLES = NO . !IFEND !ENDDEFINE. FILE HANDLE SPSS_Examples /NAME='%SPSS_HOME%\Samples\English' . FILE HANDLE Data /NAME='SPSS_Examples\survey_sample.sav' . GET FILE = Data. DATASET NAME Demo WINDOW=FRONT. *news1 news2 news3 news4 news5 are dchotomous variables (0|1) *. *Minimum arguments *. !MRTable MRVar = news1 news2 news3 news4 news5 . *Specify MRSETS tabulated value *. !MRTable TabVal = 1 MRVar = news1 news2 news3 news4 news5 . *and specify Table title *. !MRTable TTitle = 'News Sources' MRVar = news1 news2 news3 news4 news5 . *Change procedure Title *. !MRTable PTitle = 'SPSS Demo dataset Survey_Sample.sav' TTitle = 'News Sources' MRVar = news1 news2 news3 news4 news5 . *or hide procedure title *. !MRTable PTHide = 1 TTitle = 'News Sources' MRVar = news1 news2 news3 news4 news5 . John F Hall wrote > ... > Can your syntax be incorporated into a macro so that all I have to > do (outside your syntax) is enter the varlist and the value to be > tabulated? > Now that would be a really valuable tool. I'm no coder/programmer, just a > humble survey researcher with some KDF9 Algol programming 50 years ago > (8-hole paper tape input and output) to process and analyse a survey > before > SPSS came to the rescue. > > John F Hall MA (Cantab) Dip Ed (Dunelm) > [Retired academic survey researcher] > > Email: > johnfhall@ > > Website: Journeys in Survey Research > Course: Survey Analysis Workshop (SPSS) > Research: Subjective Social Indicators (Quality of Life) > INFO REFCARD -- Sent from: http://spssx-discussion.1045642.n5.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 |
| Free forum by Nabble | Edit this page |
