|
run it. See if this does what you want. * this is the data from your spreadsheet. * there are other ways to do this but this way should be clear. *first create a table of cuts. new file. data list list/gender (a4) AGE (f3) cutforpctile5 cutforpctile85 cutforpctile95(3f4.1). begin data. girl 5 13.1 17 18.3 girl 6 13.1 17.2 18.8 girl 7 13.1 17.6 19.4 girl 8 13.3 18.1 20.2 girl 9 13.6 18.8 21.1 girl 10 13.9 19.5 22.1 girl 11 14.4 20.4 23.2 girl 12 14.9 21.4 24.3 girl 13 15.5 22.4 25.4 girl 14 16 23.3 26.3 girl 15 16.5 24 26.9 girl 16 16.8 24.5 27.4 girl 17 17 24.8 27.6 girl 18 17.1 25 27.8 boy 5 13.4 16.7 17.8 boy 6 13.4 16.9 18.2 boy 7 13.5 17.3 18.8 boy 8 13.7 17.7 19.4 boy 9 13.9 18.3 20.2 boy 10 14.1 18.9 21 boy 11 14.5 19.6 22 boy 12 14.9 20.5 23.1 boy 13 15.4 21.4 24.1 boy 14 16 22.4 25.1 boy 15 16.5 23.2 26.1 boy 16 17.1 24 26.8 boy 17 17.5 24.7 27.5 boy 18 17.9 25.3 28 end data. dataset name cuttable. * make up some child data. data list list /id (f2) gender (a4) age(f2) rawbmi (f4.1). begin data 1 girl 5 10 2 girl 5 15 3 girl 5 18 4 girl 5 20 5 boy 5 10 6 boy 5 15 7 boy 5 17 8 boy 5 20 9 boy 3 15 10 girl 5 x end data. dataset name children. *make sure files are in correct order. dataset activate cuttable. sort cases by gender age. dataset activate children. sort cases by gender age. match files file=children /table=cuttable /by gender age. dataset name combined. *check the logical operators to see if they do what you want when a raw bmi is equal to the cut. numeric bmi_category (f1). do if missing(rawbmi). compute bmi_category = 0. else if rawbmi lt cutforpctile5. compute bmi_category = 1. else if rawbmi ge cutforpctile5 and rawbmi lt cutforpctile85. compute bmi_category = 2. else if rawbmi ge cutforpctile85 and rawbmi lt cutforpctile95. compute bmi_category = 3. else if rawbmi ge cutforpctile95. compute bmi_category = 4. ELSE . compute bmi_category = 5. end if. missing values bmi_category (0,5). value labels bmi_category 0 'missing bmi' 1 'underweight' 2 'normal' 3 'overweight' 4 'obese' 5 'oops check data and logic'. list. Art Kendall Social Research Consultants Jennifer Ryan wrote: Art,===================== 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
Art Kendall
Social Research Consultants |
| Free forum by Nabble | Edit this page |
