```Date: Tue, 21 Sep 2010 14:02:14 -0400 Reply-To: Art@DrKendall.org Sender: "SPSSX(r) Discussion" From: Art Kendall Organization: Social Research Consultants Subject: Re: counting frequencies of 30 columns of children who are a certain age range AND going to school. Comments: To: Deepa Lakshmi Shanadi In-Reply-To: <950405.60832.qm@web56904.mail.re3.yahoo.com> Content-type: text/html; charset=ISO-8859-1 did the syntax with simulated data do what you want?
If not please copy the output from the second LIST command that you get and paste it twice in an email.
edit the second copy so that it shows the results you are looking for.

If it did, just change the arguments in the range function to range(b5,7,15)
if  range(b5,3,18) kids = kids +1.
if  range(b5,3,18) and b8 eq 1 kidsinschool = kidsinschool + 1.
if  range(b5,7,15) kids = kids +1.
if  range(b5,7,15) and b8 eq 1 kidsinschool = kidsinschool + 1.

Art Kendall
Social Research Consultants

On 9/21/2010 11:54 AM, Deepa Lakshmi Shanadi wrote:
Dear all,
I sent an email on needing to count how many children there are in 30 columns that are between the ages of 3 to 18 AND are going to school. Thanks for your response. I picked the following and it seemed to work.

This is what I went with. IT worked for 3to18 and going to school, but then I adapted it to age range 7to15 AND going to school, but for some reason it is only picking up the part on those that are going to school, so if someone is NOT 7to15 years old, but are going to school, it is counting that. Any insight on why? Also how would you shorten this syntax?

FILTER OFF.
USE ALL.
EXECUTE.

If ((b5_age\$01 > 6 | b5_age\$01 < 16) & (B8_CURATSCH\$01 = 1)) v1 = 1.
If ((b5_age\$02 > 6 | b5_age\$02 <16) & (B8_CURATSCH\$02  = 1)) v2 = 1.
If ((b5_age\$03 > 6 | b5_age\$03 < 16) & (B8_CURATSCH\$03  = 1)) v3 = 1.
If ((b5_age\$04 > 6 | b5_age\$04 < 16) & (B8_CURATSCH\$04 = 1)) v4 = 1.
If ((b5_age\$05 > 6 | b5_age\$05 < 16) & (B8_CURATSCH\$05   = 1)) v5 = 1.
If ((b5_age\$06 > 6 | b5_age\$06 < 16) & (B8_CURATSCH\$06  = 1)) v6 = 1.
If ((b5_age\$07 > 6 | b5_age\$07 < 16) & (B8_CURATSCH\$07   = 1)) v7 = 1.
If ((b5_age\$08 > 6 | b5_age\$08 < 16) & (B8_CURATSCH\$08  = 1)) v8 = 1.
If ((b5_age\$09 > 6 | b5_age\$09 < 16) & (B8_CURATSCH\$09  = 1)) v9 = 1.
If ((b5_age\$10 > 6 | b5_age\$10 < 16) & (B8_CURATSCH\$10 = 1)) v10 = 1.
If ((b5_age\$11 > 6 | b5_age\$11 < 16) & (B8_CURATSCH\$11 = 1)) v11 = 1.
If ((b5_age\$12 > 6 | b5_age\$12 < 16) & (B8_CURATSCH\$12 = 1)) v12 = 1.
If ((b5_age\$13 > 6 | b5_age\$13 < 16) & (B8_CURATSCH\$13= 1)) v13 = 1.
If ((b5_age\$14> 6 | b5_age\$14 < 16) & (B8_CURATSCH\$14= 1)) v14 = 1.
If ((b5_age\$15 > 6 | b5_age\$15 < 16) & (B8_CURATSCH\$15= 1)) v15 = 1.
If ((b5_age\$16 > 6 | b5_age\$16 < 16) & (B8_CURATSCH\$16= 1)) v16 = 1.
If ((b5_age\$17 > 6 | b5_age\$17 < 16) & (B8_CURATSCH\$17= 1)) v17 = 1.
If ((b5_age\$18> 6 | b5_age\$18 < 16) & (B8_CURATSCH\$18= 1)) v18 = 1.
If ((b5_age\$19> 6 | b5_age\$19 < 16) & (B8_CURATSCH\$19= 1)) v19 = 1.
If ((b5_age\$20 > 6 | b5_age\$20 < 16) & (B8_CURATSCH\$20= 1)) v20 = 1.
If ((b5_age\$21 > 6 | b5_age\$21 < 16) & (B8_CURATSCH\$21= 1)) v21 = 1.
If ((b5_age\$22 > 6 | b5_age\$22 < 16) & (B8_CURATSCH\$22= 1)) v22= 1.
If ((b5_age\$23> 6 | b5_age\$23 < 16) & (B8_CURATSCH\$23= 1)) v23 = 1.
If ((b5_age\$24> 6 | b5_age\$24 < 16) & (B8_CURATSCH\$24= 1)) v24 = 1.
If ((b5_age\$25> 6 | b5_age\$25 < 16) & (B8_CURATSCH\$25= 1)) v25= 1.
If ((b5_age\$26> 6 | b5_age\$26 < 16) & (B8_CURATSCH\$26= 1)) v26 = 1.
If ((b5_age\$27> 6 | b5_age\$27 < 16) & (B8_CURATSCH\$27= 1)) v27 = 1.
If ((b5_age\$28> 6 | b5_age\$28 < 16) & (B8_CURATSCH\$28= 1)) v28 = 1.
If ((b5_age\$29> 6 | b5_age\$29 < 16) & (B8_CURATSCH\$29= 1)) v29 = 1.
If ((b5_age\$30> 6 | b5_age\$30 < 16) & (B8_CURATSCH\$30= 1)) v30 = 1.

COUNT age7to15andschoolfrequency = v1 to v30  (1).
EXECUTE.

FREQUENCIES VARIABLES=age7to15andschoolfrequency
/ORDER=ANALYSIS.

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (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 ```

Back to: Top of message | Previous page | Main SPSSX-L page