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 (February 2012)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 15 Feb 2012 15:49:44 -0500
Reply-To:     ANDRES ALBERTO BURGA LEON <aburgal@minedu.gob.pe>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         ANDRES ALBERTO BURGA LEON <aburgal@minedu.gob.pe>
Subject:      Converting to string, replace, recode
Content-Type: multipart/alternative;

Hello to everybody oin the list:

I have some numeric variables, with values between 0 and 100 (percentages)

I need to have them as strings, with comma as a decimal separator.

I have the following sintax, and I wonder if it could be made simpler (not

using all the RECODE)

ALTER TYPE p_g1_ie_C_11 TO p_g3_ie_M_11 (A6). DO REPEAT X = p_g1_ie_C_11 TO p_g3_ie_M_11. COMPUTE X = LTRIM(X). COMPUTE X = REPLACE(X,'.',','). END REPEAT. EXECUTE. RECODE p_g1_ie_C_11 TO p_g3_ie_M_11 (',0'='0,0') (',1'='0,1') (',2'='0,2') (',3'='0,3') (',4'='0,4') (',5'='0,5') (',6'='0,6') (',7'='0,7')

(',8'='0,8') (',9'='0,9'). EXECUTE.

Also I have other variables that could have negatives values lower than 1.

(value range -100 to 100, because is a diference in percentages).

For example the original variable values are .9; 3.6; -.4; -5.7, etc. The new string values should be: 0,9; 3,6; -0,4; -5,7 and so on. I'm not sure how to do this, other than:

RECODE X TO Y ('-,1'='-0,1'), ('-,2'='0,2'), etc

Any sugestions?

Thank you

Andrés


[text/html]


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