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 2004)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 3 May 2004 22:31:55 -0400
Reply-To:     "Hetter, Rebecca D,,DMDCWEST" <>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Hetter, Rebecca D,,DMDCWEST" <>
Subject:      Re: syntax to change numeric to character
Content-Type: text/plain

I have 11.5, and this (untested) should work:


* OPTIONAL: ADD LEADING ZEROS TO A NUMBER. formats field1 to field230(n4).

* CREATE A NEW STRING VARIABLE AND CONVERT . string new1 to new230(a4). do repeat x=field1 to field230/y=new1 to new230 . compute y=string(x,n4). end repeat.

* LIST A FEW CASES TO CHECK (OMIT FOR THE LARGE FILE). list var field1 new1 field2 new2 field230 new230.

* DELETE THE ORIGINAL VARIABLE . add files file=*/DROP= field1 to field230. exe. * CREATE AGAIN AS A STRING VARIABLE . string field1 to field230(a4). * NOW RENAME IT . add files file=*/RENAME=(new1 to new230) = field1 to field230). exe.

I am not sure about needing the "exe" .

HTH ---

Becky Hetter Research Psychologist Defense Manpower Data Center Personnel Testing Division 400 Gigling Rd Seaside, CA 93955

-----Original Message----- From: Carol Jones [] Sent: Monday, May 03, 2004 12: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

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