Replace special characters in variable labels

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

Replace special characters in variable labels

drfg2008
On another platform, someone is looking for a solution to replace special characters in variable labels. Is that possible without Python?

I had found something similar on that platform once, but can not find the post.

Thank you.
Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: Replace special characters in variable labels

Art Kendall
This is a kludge if you only have a few characters to replace.
switch to the variables view
from some place (e.g., a syntax window )pick up a string you want to replace (Cntl-C on windows).
click the header "label" at the top of that column. It will highlight the column.
click <edit> <replace>
in the first edit box paste the bad string. (Cntl-V on windows).
in the other edit box type the desired string.
click <replace all>

If you cannot type the undesired string in a syntax window, try copying a label in to the first edit box and then delete character until all that is left is the string you want to replace.

I tried it using "%" as the old string and "percent" as the new string on version 20 under windows7 home premium 64-bit.

hth

Art Kendall
Social Research Consultants


On 10/7/2011 3:42 AM, drfg2008 wrote:
On another platform, someone is looking for a solution to replace special
characters in variable labels. Is that possible without Python?

I had found something similar on that platform once, but can not find the
post.

Thank you.

-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Replace-special-characters-in-variable-labels-tp4879232p4879232.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Replace special characters in variable labels

drfg2008
Thanks Art.

For the asking 'professional' in this case, the mouse is his best friend, I suppose.

Frank
Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: Replace special characters in variable labels

Jon K Peck
This would be trivial to automate with Python, but you can do a little better than manual editing with standard syntax.

Run code such as the following to generate prototype VARIABLE LABELS commands, and then use search and replace for the offending characters.

data list free /a b c.
begin data
1 2 3
end data.
variable label a "the labél fôr a".
variable label b "this ïs b".
variable label c "áèîôü".
dataset declare dict.
oms select tables /if subtypes='Variable Information'
/destination outfile=dict format=sav.
display dict.
omsend.
dataset activate dict.
PRINT OUTFILE="filespec" / "VARIABLE LABEL " Var1 '"' Label '"'.
exec.

Jon Peck (no "h")
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        drfg2008 <[hidden email]>
To:        [hidden email]
Date:        10/08/2011 06:52 AM
Subject:        Re: [SPSSX-L] Replace special characters in variable labels
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Thanks Art.

For the asking 'professional' in this case, the mouse is his best friend, I
suppose.

Frank

-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Replace-special-characters-in-variable-labels-tp4879232p4882723.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Reply | Threaded
Open this post in threaded view
|

Re: Replace special characters in variable labels

Art Kendall
In reply to this post by drfg2008
You're welcome.

Art

On 10/8/2011 8:48 AM, drfg2008 wrote:
Thanks Art.

For the asking 'professional' in this case, the mouse is his best friend, I
suppose.

Frank

-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Replace-special-characters-in-variable-labels-tp4879232p4882723.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Art Kendall
Social Research Consultants