Login  Register

Re: SYNTAX TO ADD INTERNATIONAL DIALLING CODE

Posted by Bruce Weaver on Feb 22, 2023; 6:26pm
URL: http://spssx-discussion.165.s1.nabble.com/SYNTAX-TO-ADD-INTERNATIONAL-DIALLING-CODE-tp5741118p5741119.html

Look up the CONCAT function.  E.g.,

* Read in some data to illustrate.
NEW FILE.
DATASET CLOSE ALL.
DATA LIST LIST / phone1 (A11).
BEGIN DATA
"07970471126"
"0123456789"
END DATA.
* Declare new string variable for code+number.
STRING phone2 (A14).
* Use CONCAT function to join +44 and phone1.
COMPUTE phone2 = CONCAT("+44", phone1).
LIST.

Output from the LIST command:  

phone1      phone2
 
07970471126 +4407970471126
0123456789  +440123456789


--
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/).