Date: Tue, 21 Sep 2010 12:30:34 -0700
Reply-To: Bruce Weaver <bruce.weaver@hotmail.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Bruce Weaver <bruce.weaver@hotmail.com>
Subject: Re: Fw: counting frequencies of 30 columns of children who
are a certain age range AND going to school.
In-Reply-To: <302579.13014.qm@web56904.mail.re3.yahoo.com>
Content-Type: text/plain; charset=us-ascii
Deepa Lakshmi Shanadi wrote:
>
> Why am I getting this silly error message for the following syntax???
>
>>Error # 4285 in column 2. Text: B5_
>>Incorrect variable name: either the name is more than 64 characters, or it
is
>>not defined by a previous command.
>>This command not executed.
> EXECUTE.
>
> WOULD THIS WORK to calculate those that are aged 7to15 and going to school
> in my
> 30 columns from 2 sets of varibles? Sorry, I am having a hard time
> following the
> shortened syntax.
>
>
> COMPUTE age7to15andschool = ((B5_AGE$01>6 and B5_AGE$01 < 16) and
> (B8_CURATSCH$01 = 1)) or
>
> (B5_AGE$02>6 and B5_AGE$02 <16 and B8_CURATSCH$02 = 1 )
> or (B5_AGE$03>6 and B5_AGE$03 <16 and B8_CURATSCH$03 = 1) or
> (B5_AGE$04>6 and B5_AGE$04 <16 and B8_CURATSCH$04 = 1 ) or
> (B5_AGE$05>6 and B5_AGE$05 <16 and B8_CURATSCH$05 = 1) or
> (B5_AGE$06>6 and B5_AGE$06 <16 and B8_CURATSCH$06 = 1) or
> (B5_AGE$07>6 and B5_AGE$07 <16 and B8_CURATSCH$07 = 1) or
> (B5_AGE$08>6 and B5_AGE$08 <16 and B8_CURATSCH$08 = 1)
> or (B5_AGE$09>6 and B5_AGE$09 <16 and B8_CURATSCH$09 = 1) or
> (B5_AGE$10>6 and B5_AGE$10<16 and B8_CURATSCH$10 = 1) or
> (B5_ AGE$11>6 and B5_AGE$11 <16 and B8_CURATSCH$11 = 1) or
> (B5_AGE$12>6 and B5_AGE$12 <16 and B8_CURATSCH$12 = 1)
> or (B5_AGE$13>6 and B5_AGE$13 <16 and B8_CURATSCH$13 = 1) or
> (B5_AGE$14>6 and B5_AGE$14<16 and B8_CURATSCH$14 = 1) or
> (B5_AGE$15>6 and B5_AGE$15 <16 and B8_CURATSCH$15 = 1)
> or (B5_AGE$16>6 and B5_AGE$16 <16 and B8_CURATSCH$16 = 1) or
> (B5_AGE$17>6 and B5_AGE$17 <16 and B8_CURATSCH$17 = 1) or
> (B5_AGE$18>6 and B5_AGE$18 <16 B8_CURATSCH$18 = 1) or
> (B5_AGE$19>6 and B5_AGE$19 <16 and B8_CURATSCH$19=1)
> or (B5_AGE$20>6 and B5_AGE$20<16 and B8_CURATSCH$20 = 1) or
> (B5_AGE$21>6 and B5_AGE$21<16 and B8_CURATSCH$21 = 1) or
> (B5_AGE$22>6 and B5_AGE$22<16 and B8_CURATSCH$22 = 1) or
> (B5_AGE$23>6 and B5_AGE$23<16 and B8_CURATSCH$23 = 1)
> or (B5_AGE$24<6 and B5_AGE$24<16 and B8_CURATSCH$24 = 1) or
> (B5_AGE$25>6 and B5_AGE$25<16 and B8_CURATSCH$25 = 1) or
> (B5_AGE$26>6 and B5_AGE$26<16 and B8_CURATSCH$26 = 1) or
> (B5_AGE$27>2 and B5_AGE$27<16 and B8_CURATSCH$27 = 1) or
> (B5_AGE$28>6 and B5_AGE$28<16 and B8_CURATSCH$28 = 1) or
> (B5_AGE$29>6 and B5_AGE$29<16 and B8_CURATSCH$29=1) or
> (B5_AGE$30>6 and B5_AGE$30<16 and B8_CURATSCH$30 = 1).
> EXECUTE.
>
>
> But I get this message:
>>Error # 4285 in column 2. Text: B5_
>>Incorrect variable name: either the name is more than 64 characters, or it
is
>>not defined by a previous command.
>>This command not executed.
> EXECUTE.
>
>
Searching for "B5_ " in your syntax took me to this row:
(B5_ AGE$11>6 and B5_AGE$11 <16 and B8_CURATSCH$11 = 1) or
You have a space between B5_ and AGE$11.
I'm not sure which shortened syntax you were having trouble with, but isn't
something like the following a lot easier?
* This assumes the Age variables appear in one block,
* and the School variables in another block.
* If they do not, you'll either have to sort the variables
* to make that happen, or list each variable on the DO-REPEAT.
* It also assumes there is no missing data.
compute #count = 0.
do repeat age = b5_age$01 to b5_age$30 /
sch = B8_CURATSCH$01 to B8_CURATSCH$30 .
- if range(age,7,15) and (sch EQ 1) #count = #count + 1.
end repeat.
COMPUTE age7to15andschoolfrequency = #count.
FREQUENCIES age7to15andschoolfrequency.
-----
--
Bruce Weaver
bweaver@lakeheadu.ca
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.
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/counting-frequencies-of-30-columns-of-children-who-are-a-certain-age-range-AND-going-to-school-tp2848283p2848656.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.
=====================
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