Date: Tue, 17 Jun 2003 14:20:34 -0400
Reply-To: Raynald Levesque <rlevesque@videotron.ca>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Raynald Levesque <rlevesque@videotron.ca>
Subject: Re: matrix language
In-Reply-To: <5.1.1.6.0.20030617160433.01aac6e8@tinet.org>
Content-type: text/plain; charset=iso-8859-1
Hi
* Create 2 data files.
data list list /a1 a2.
begin data
2 1
1 3
5 2
3 3
end data.
save outfile='c:\temp\file a.sav'.
data list list /b1 b2 b3.
begin data
3 2 5
4 4 3
end data.
save outfile='c:\temp\file b.sav'.
* read the data files and multipy the matrices.
matrix.
get a /file='c:\temp\file a.sav' /variables=a1 to a2.
get b /file='c:\temp\file b.sav'/variables=b1 to b3.
compute c=a*b.
print c.
end matrix.
*The results is
C
10 8 13
15 14 14
23 18 31
21 18 24
Regards
Raynald Levesque rlevesque@videotron.ca
Visit my SPSS Pages http://pages.infinit.net/rlevesqu/index.htm
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of
Albert Maydeu-Olivares
Sent: June 17, 2003 10:09 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: matrix language
Dear all,
It's been at least 15 years since I last used the SPSS matrix language. I
would very much appreciate if anyone could send me some code to do this
simple job. I'd use it for teaching purposes.
Import a SPSS data file into matrix A
mport another SPSS data file into matrix B
Compute C = A * B (they're conformable of course)
Output C as a SPSS data file.
Thanks!
Albert
----------------------------------------------------------------------
Albert Maydeu-Olivares Tel. +34 933 125 133
Faculty of Psychology Fax. +34 934 021 362
University of Barcelona E-Mail: amaydeu@tinet.fut.es
P. Valle de Hebrón, 171
08035 - Barcelona (Spain)
http://www.ub.es/personal/amaydeu/amaydeuen.html
----------------------------------------------------------------------