Using multiple datasets/SQL

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using multiple datasets/SQL

Cardiff Tyke
Hi,

I'm currently manipulating an SPSS dataset and now I need to multiply a variable in my current dataset by a value in another dataset (or in a SQL database).  Can anyone enlighten me on how to do this?  

I am multiplying 84 variables - M1 * 1, M2 * 2 ... M84 * 84

I can extract the variables from the SQL database into a second dataset (called Untitled2 [Allocation] ) using syntax.  It would be advantageous if I could reference the variables directly from a SQL table known as tblDrgData but I'm not sure if this is possible or not.

Thanks in advance,
JC


       
       
               
___________________________________________________________
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes.
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk
Reply | Threaded
Open this post in threaded view
|

Re: Using multiple datasets/SQL

Dennis Deck
I'm not entirely clear about what you want to do but the following
points may help:

A) You appear to be multiplying each of 84 variables by a constant.  Not
sure where the database comes in.  Use DO REPEAT:

DO REPEAT
   m = M1 TO M84
  /c - 1 TO 84 .
+  COMPUTE m = m * c .
END REPEAT .

B) You can use GET DATA to extract from a database assuming you have the
ODBC driver set up.  Use the Wizard to generate the initial syntax.  IF
you know SQL you could edit the generated syntax to tweak it to extend
it and make it more readable (but debugging any errors will require some
trial and error).

C) If you need to access two databases you have a few options:
 1) Extract each one individually to SPSS with GET DATA and join the SAV
files using MATCH FILES or ADD FILES as appropriate.
 2) Edit the GET DATA to do the JOIN (the wizard won't be of much help)
 3) The BEST approach would be to create a query or view in the database
and then use GET DATA to access this.



Dennis Deck, PhD
RMC Research Corporation
[hidden email]

-----Original Message-----
From: Cardiff Tyke [mailto:[hidden email]]
Sent: Tuesday, February 27, 2007 8:01 AM
Subject: Using multiple datasets/SQL

Hi,

I'm currently manipulating an SPSS dataset and now I need to multiply a
variable in my current dataset by a value in another dataset (or in a
SQL database).  Can anyone enlighten me on how to do this?

I am multiplying 84 variables - M1 * 1, M2 * 2 ... M84 * 84

I can extract the variables from the SQL database into a second dataset
(called Untitled2 [Allocation] ) using syntax.  It would be advantageous
if I could reference the variables directly from a SQL table known as
tblDrgData but I'm not sure if this is possible or not.

Thanks in advance,
JC





___________________________________________________________
New Yahoo! Mail is the ultimate force in competitive emailing. Find out
more at the Yahoo! Mail Championships. Plus: play games and win prizes.
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk