|
Hi Carol,
If you will do it only few times, do it without syntax:
- In SPSS Data Editor, Variable View, change Type from Numeric to String for the first variable
- Copy (Ctrl-C) the word String from the cell, select Types of all other variables and paste "String" (Ctrl-V) - it changes them all
- If needed, you can paste number "4" to the Width column.
If you do it regularly, then use syntax in this way: Save the data as an ASCII file and read it again setting the types of variables as needed. The Text Import Wizard helps you greatly here. An example:
GET FILE='C:\Program Files\SPSS\Mouse survival.sav'.
formats all (f5).
SAVE TRANSLATE OUTFILE='C:\Program Files\SPSS\Mouse survival.dat'
/TYPE=TAB /MAP /REPLACE /FIELDNAMES.
GET DATA /TYPE = TXT
/FILE = 'C:\Program Files\SPSS\Mouse survival.dat'
/DELCASE = LINE /DELIMITERS = "\t" /ARRANGEMENT = DELIMITED
/FIRSTCASE = 2 /IMPORTCASE = ALL
/VARIABLES = icrf A5 hxm A5 status A5 time A5 hxmd A5 icrfd A5 icrfsq A5 hmxsq A5 icrfhilo A5 .
EXECUTE.
Greetings
Jan
-----Original Message-----
From: Carol Jones [mailto:jonesce@michigan.gov]
Sent: Monday, May 03, 2004 9:19 PM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: syntax to change numeric to character
I have two hundred and thirty fields in my dataset. I am using ver 12.
I need to change all the fields from (F4.0) to (A4) - the field names
need to remain the same. Can someone share some syntax to perform this
task? Thanks
|