Date: Wed, 25 May 2011 06:58:16 -0700
Reply-To: David Marso <david.marso@gmail.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: David Marso <david.marso@gmail.com>
Subject: Re: using vectors and matrixes
In-Reply-To: <007c01cc1ae0$d3853260$7a8f9720$@ro>
Content-Type: text/plain; charset=us-ascii
See the MATRIX language documentation in the manual.
You can very easily implement this.
Bogdan Voicu wrote:
>
> Dear all,
>
>
>
> I have a repetitive task, which requires computing several weighted means
> for each case in a data base.
>
> More exactly, for each case there are 9 variables (zR011HF to zr019HF),
> that
> I need to sum up weighted with different weights, depending on the values
> (ranging from 1 to 6) of another variable (idd6bis).
>
>
>
> The operation repeats with several other sets of variable and I expect
> that
> I will need to change several times the weights, when simulating the final
> model.
>
>
>
> My idea was to build a series of commands like this one:
>
>
>
> vector prim=zR011HF to zr019HF.
>
> vector weights=
>
> 65 5 5 10 6 5
> 4 0 0
>
> 40 15 5 15 11 9
> 5 0 0
>
> 50 7 5 15 10 8
> 5 0 0
>
> 30 10 10 20 15 10
> 5 0 0
>
> 10 20 10 20 30 5
> 5 0 0
>
> 5 5 5 15 10 5
> 5 25 25.
>
> loop #i=1 to 6.
>
> loop #j=1 to 9.
>
> compute k=#j+(#i-1)*#j.
>
> if idd6bis=#i zR01HF=sum(zR01HF, weights(k)*prim(#j)).
>
> end loop.
>
> end loop.
>
> exe.
>
> del var k.
>
>
>
> The above solution does not work. I cannot use the vector command for the
> weights. My question is which command should I use to declare the weights
> as
> a matrix/vector, using the syntax file.
>
>
>
> Thank you in advance!
>
> Bogdan
>
>
>
>
>
>
>
> _____
>
> Bogdan Voicu
>
> Principal research fellow, Romanian Academy of Science, Research Institute
> for Quality of Life
>
> Associate professor, Department of Sociology, Lucian Blaga University of
> Sibiu
>
> <mailto:bogdan@iccv.ro> bogdan@iccv.ro;
> <http://www.bogdanvoicu.ro/>
> http://www.bogdanvoicu.ro
>
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/using-vectors-and-matrixes-tp4425287p4425351.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
|