Re: Simple Problem with SPSS -- PLEASE HELP!!

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Simple Problem with SPSS -- PLEASE HELP!!

Art Kendall
Open SPSS. Paste the syntax below into a new syntax window.
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,
Thanks for your reply! Sorry I didn't get back to you earlier -- this is not my preferred email address. 
I am using the standardized age and sex-specific percentiles from 2007 WHO standards. I have attached the percentile sheets I am referencing - one for girls and one for boys.  I am also attaching an excel spreadsheet I made, based on these two percentile sheets.  As you will see, the ranges up to and between the 5th, 85th, and 95th percentiles are the significant cut-offs for my study. So, for example, for Girl Age 5, I took percentile numbers for 5y/1m, 5y/6m, and 5y/11m at 5th, 85th, and 95th respectively. Using my excel sheet for the cut-offs for SPSS, I figured that would be a reasonable solution for accurate numbers.

I hope to hear from you again.
Thank you,
Jennifer




On Thu, Nov 5, 2009 at 1:00 PM, Art Kendall <[hidden email]> wrote:
Please tell us more about the data you have available. Do you need to get the percentiles from your own data or from pre-existing tables?


Art Kendall
Social Research Consultants

Jennifer Ryan wrote:
Hi,
I'm a grad student and am working with SPSS for the first time for a
sociology paper, which is about inequalities and obesity in China.  I
have learned some basics, but am running into a problem trying to
create weight ranges and categories for children of different ages.

Basically, I have the data on the child weight and height, which is
what you need to calculate BMI.  However, calculating BMI for children
is a bit tricky because child BMI is age and sex-specific, meaning
weight categories are defined by where the child falls in the
percentile for his or her age and gender. (For example, over 95th
percentile is considered obese).

I need to know how to create ranges for each gender at each age (5-18
yrs.), so I can then place them into the right weight categories
(underweight, healthy weight, overweight, obese).

PLEASE HELP!! I would be forever grateful!!
Jennifer
 

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