I have a large Microsoft Access database that I've imported into SPSS (v
9.0) using the database query function. I am generally very happy with
how the conversion takes place, with one exception: although almost all
the fields/variables are numeric, SPSS assigns them as string
variables. I am well aware that I can change the variables one by one
from string to numeric, using the "Define Variable" window and selecting
the appropriate radio buttons. However, I would like to write a simple
syntax routine that would convert the variables all in one fell swoop,
and I do NOT want to have to create a new set of variables to do this.
I've read online help and have pored over manuals and I can't figure out
if this is possible. I will be very grateful for any help anyone can
give me.
Shelley
--
**********************************************************
Children today are tyrants. They contradict their parents,
gobble their food, and tyrannize their teachers.
-- Socrates, 470 -399 A.D.
**********************************************************
if spss is importing numeric as string it could be possible that the
first row of data is a string within that column.
spss will use the first row's properties within a column to determine
the column properties when importing.
i do not know of any other hints, so good luck.
Sent via Deja.com http://www.deja.com/
Before you buy.
DATA LIST/ seqnum v1 to v3 1-4 (a).
BEGIN DATA
1292
3455
2379
END DATA.
LIST .
COMPUTE numvar=NUMBER(v3,F1).
MATCH FILES FILE=*
/KEEP seqnum v1 v2 numvar .
RENAME VARIABLES (numvar=v3) .
list.
EXE.
--
Joel P. Wiesen, Ph.D., Director
Applied Personnel Research
27 Judith Road
Newton, Massachusetts 02459-1715
(617) 244-8859
Wie...@personnelselection.com
www.personnelselection.com/apr.htm
We develop personnel selection systems to be valid,
reliable, fair, practical, and legal.
Learn about our test of mechanical aptitude:
www.personnelselection.com/wtma.htm
Learn about our test of programmer/analyst aptitude:
www.personnelselection.com/programmer.htm
If you know the Variable is supposed to be numeric then you can:
rename (var = var1).
compute var = num(var1,F8.0).
Warning! if the numeric var has decimals then you have to declare it first.
rename (var = var1).
numeric var (F8.1).
compute var = num(var1,F8.0).
** it looks weird but it keeps SPSS from messing up the decimal conversion.
I hope this helps
Russ