LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2011)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 25 May 2011 13:02:58 -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:   <3D90CBF6C2C40D4CBAF257453855ACCF139D0E1B@aspsexm1.cen.csin.cz>
Content-Type:   text/plain; charset=UTF-8

MATRIX is a much more concise and general way to do such a task. Obviously not tested, but general idea as follows. Computational goal is REALLY a simple matrix multiplication. MATRIX. GET RAW /VARIABLES= zR011HF to zr019HF / FILE=*. COMPUTE WTS={65, 5, 5, 10, 6, 5,4, 0, 0; 40, 15 , 5............; ............ 10 , 5, 5, 25 ,25}. COMPUTE TW=T(WTS). COMPUTE WTSCALE=RAW*TW. SAVE .... RTFM for exact syntax. END MATRIX. THE WTS matrix can also be read from a system file. -----

Spousta Jan wrote: > > Hi Bogdan, first create the variables weights (e.g. paste the values from > Excel and name them w1 to w9) and then you can define vector weights = w1 > to w9 and use it in a loop. > > Jan > > ________________________________ > From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of > Bogdan Voicu > Sent: Wednesday, May 25, 2011 3:37 PM > To: SPSSX-L@LISTSERV.UGA.EDU > Subject: using vectors and matrixes > > 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 > bogdan@iccv.ro&lt;mailto:bogdan@iccv.ro&gt;; > http://www.bogdanvoicu.ro&lt;http://www.bogdanvoicu.ro/&gt; > > > > > _____________ > Tato zpráva a všechny připojené soubory jsou důvěrné a určené výlučně > adresátovi(-ům). Jestliže nejste oprávněným adresátem, je zakázáno > jakékoliv zveřejňování, zprostředkování nebo jiné použití těchto > informací. Jestliže jste tento mail dostali neoprávněně, prosím, uvědomte > odesilatele a smažte zprávu i přiložené soubory. Odesilatel nezodpovídá za > jakékoliv chyby nebo opomenutí způsobené tímto přenosem. > > P Jste si jisti, že opravdu potřebujete vytisknout tuto zprávu a/nebo její > přílohy? Myslete na přírodu. > > > This message and any attached files are confidential and intended solely > for the addressee(s). Any publication, transmission or other use of the > information by a person or entity other than the intended addressee is > prohibited. If you receive this in error please contact the sender and > delete the message as well as all attached documents. The sender does not > accept liability for any errors or omissions as a result of the > transmission. > > P Are you sure that you really need a print version of this message and/or > its attachments? Think about nature. > -.- -- >

-- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/using-vectors-and-matrixes-tp4425287p4426454.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


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