Re: SYNTAX TO ADD INTERNATIONAL DIALLING CODE
Posted by
Bruce Weaver on
Feb 23, 2023; 1:49pm
URL: http://spssx-discussion.165.s1.nabble.com/SYNTAX-TO-ADD-INTERNATIONAL-DIALLING-CODE-tp5741118p5741121.html
Use LTRIM to remove the leading 0:
COMPUTE phone2 = CONCAT("+44", LTRIM(phone1,"0")).
The BEGIN DATA and END DATA lines in my code are just part of the DATA LIST command I used to read in some data to illustrate the approach. You can ignore those lines, as you already have a data file. All you need is this bit:
STRING phone2 (A14).
COMPUTE phone2 = CONCAT("+44", LTRIM(phone1,"0")).
EXECUTE.
Replace phone1 and phone2 with your own variable names.
researcher wrote
Thanks a lot Bruce
I would still need to lose the first zero somehow but that look useful
Excuse my ignorance but what is 'begin data' and 'end data' actually doing? Is that specifying a range of cases in the variable so that if I wanted to do all the case I would not need to use that?
Appreciate your help
Mike
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/"When all else fails, RTFM."
PLEASE NOTE THE FOLLOWING:
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (
https://listserv.uga.edu/).