ISO country codes syntax

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

ISO country codes syntax

dtaylor_elca
Does anyone have available (or know where I can find) syntax to convert country names into ISO 3166-1-alpha-2 code elements.  I'm trying to create an intensity map showing levels of involvement in various countries.
Thanks in advance.

Dann Taylor
Research Analyst
Research and Evaluation
Evangelical Lutheran Church in America
[hidden email]
(773) 380-2990

=====================
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: ISO country codes syntax

Wilhelm Landerholm | Queue
Hi Dann!
I think you are looking for something like this:
http://spss.statb.com/syntax/ISO3166.txt

All the best

Wilhelm (Wille) Landerholm
+46-735-460000
Calendar

Queue/STATB
BOX 92
162 12 Vallingby
Sweden

http://www.qsweden.com
http://www.statb.com

QUEUE/STATB - your partner in data analysis, data modeling and data mining.

Daniel Taylor skrev 2010-06-17 13:03:
Does anyone have available (or know where I can find) syntax to convert country names into ISO 3166-1-alpha-2 code elements.  I'm trying to create an intensity map showing levels of involvement in various countries.
Thanks in advance.

Dann Taylor
Research Analyst
Research and Evaluation
Evangelical Lutheran Church in America
[hidden email]
(773) 380-2990

=====================
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: ISO country codes syntax

Bruce Weaver
Administrator
Very good of those folks to provide the code.  But I think I would have used RECODE rather than a series of IF statements.  I.e.,

compute country_name = UPCASE(RTRIM(country_name)).
recode country_name
 ("ANDORRA"  = "AD")
 ("UNITED ARAB EMIRATES" = "AE")
 .
 .
 .
 ("ZIMBABWE" = "ZW") into  ISO3166.
exe.



Wilhelm Landerholm | Queue wrote
Hi Dann!
I think you are looking for something like this:
http://spss.statb.com/syntax/ISO3166.txt

All the best

Wilhelm (Wille) Landerholm
+46-735-460000
Calendar
<http://www.google.com/calendar/embed?src=wilhelm.landerholm%40gmail.com&ctz=Europe/Stockholm>

Queue/STATB
BOX 92
162 12 Vallingby
Sweden

http://www.qsweden.com
http://www.statb.com

QUEUE/STATB - your partner in data analysis, data modeling and data mining.

Daniel Taylor skrev 2010-06-17 13:03:
> Does anyone have available (or know where I can find) syntax to convert country names into ISO 3166-1-alpha-2 code elements.  I'm trying to create an intensity map showing levels of involvement in various countries.
> Thanks in advance.
>
> Dann Taylor
> Research Analyst
> Research and Evaluation
> Evangelical Lutheran Church in America
> daniel.taylor@elca.org
> (773) 380-2990
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> LISTSERV@LISTSERV.UGA.EDU (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
>
>
--
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/).
Reply | Threaded
Open this post in threaded view
|

Re: ISO country codes syntax

Jon K Peck

Along these lines, I would go a step further for readability and ease of checking correctness.  A long recode or sequence of DO IF... is hard to check.

First I would create a dataset containing the country name and the ISO code.  That is easy to check and might be importable directly if you can find the table in Excel or some other format that Statistics can read.

Then I would use a table match in Statistics or an ODBC  SQL join to get the ISO codes attached.

Alternatively, I could use the mapping dataset as a lookup table via the programmability extension command spssinc trans.

spssinc trans result = resultcodealpha  type=2
/initial "extendedTransforms.vlookup('country', 'ISO', 'mapping')"
/formula func(country).

HTH,
Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: Bruce Weaver <[hidden email]>
To: [hidden email]
Date: 06/17/2010 12:51 PM
Subject: Re: [SPSSX-L] ISO country codes syntax
Sent by: "SPSSX(r) Discussion" <[hidden email]>





Very good of those folks to provide the code.  But I think I would have used
RECODE rather than a series of IF statements.  I.e.,

compute country_name = UPCASE(RTRIM(country_name)).
recode country_name
("ANDORRA"  =  "AD")
("UNITED ARAB EMIRATES" = "AE")
.
.
.
("ZIMBABWE" = "ZW") into  ISO3166.
exe.




Wilhelm Landerholm | Queue wrote:
>
> Hi Dann!
> I think you are looking for something like this:
>
http://spss.statb.com/syntax/ISO3166.txt
>
> All the best
>
> Wilhelm (Wille) Landerholm
> +46-735-460000
> Calendar
> <
http://www.google.com/calendar/embed?src=wilhelm.landerholm%40gmail.com&ctz=Europe/Stockholm>
>
> Queue/STATB
> BOX 92
> 162 12 Vallingby
> Sweden
>
>
http://www.qsweden.com
>
http://www.statb.com
>
> QUEUE/STATB - your partner in data analysis, data modeling and data
> mining.
>
> Daniel Taylor skrev 2010-06-17 13:03:
>> Does anyone have available (or know where I can find) syntax to convert
>> country names into ISO 3166-1-alpha-2 code elements.  I'm trying to
>> create an intensity map showing levels of involvement in various
>> countries.
>> Thanks in advance.
>>
>> Dann Taylor
>> Research Analyst
>> Research and Evaluation
>> Evangelical Lutheran Church in America
>> [hidden email]
>> (773) 380-2990
>>
>> =====================
>> 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
>>
>>
>
>


-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."

NOTE:  My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
--
View this message in context:
http://old.nabble.com/ISO-country-codes-syntax-tp28913007p28918213.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: ISO country codes syntax

Bruce Weaver
Administrator
Good ideas, Jon.  I didn't think of using a look-up table.


Jon K Peck wrote
Along these lines, I would go a step further for readability and ease of
checking correctness.  A long recode or sequence of DO IF... is hard to
check.

First I would create a dataset containing the country name and the ISO
code.  That is easy to check and might be importable directly if you can
find the table in Excel or some other format that Statistics can read.

Then I would use a table match in Statistics or an ODBC  SQL join to get
the ISO codes attached.

Alternatively, I could use the mapping dataset as a lookup table via the
programmability extension command spssinc trans.

spssinc trans result = resultcodealpha  type=2
/initial "extendedTransforms.vlookup('country', 'ISO', 'mapping')"
/formula func(country).

HTH,
Jon Peck
SPSS, an IBM Company
peck@us.ibm.com
312-651-3435



From:
Bruce Weaver <bruce.weaver@hotmail.com>
To:
SPSSX-L@LISTSERV.UGA.EDU
Date:
06/17/2010 12:51 PM
Subject:
Re: [SPSSX-L] ISO country codes syntax
Sent by:
"SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>



Very good of those folks to provide the code.  But I think I would have
used
RECODE rather than a series of IF statements.  I.e.,

compute country_name = UPCASE(RTRIM(country_name)).
recode country_name
 ("ANDORRA"  =  "AD")
 ("UNITED ARAB EMIRATES" = "AE")
 .
 .
 .
 ("ZIMBABWE" = "ZW") into  ISO3166.
exe.




Wilhelm Landerholm | Queue wrote:
>
> Hi Dann!
> I think you are looking for something like this:
> http://spss.statb.com/syntax/ISO3166.txt
>
> All the best
>
> Wilhelm (Wille) Landerholm
> +46-735-460000
> Calendar
> <
http://www.google.com/calendar/embed?src=wilhelm.landerholm%40gmail.com&ctz=Europe/Stockholm
>
>
> Queue/STATB
> BOX 92
> 162 12 Vallingby
> Sweden
>
> http://www.qsweden.com
> http://www.statb.com
>
> QUEUE/STATB - your partner in data analysis, data modeling and data
> mining.
>
> Daniel Taylor skrev 2010-06-17 13:03:
>> Does anyone have available (or know where I can find) syntax to convert
>> country names into ISO 3166-1-alpha-2 code elements.  I'm trying to
>> create an intensity map showing levels of involvement in various
>> countries.
>> Thanks in advance.
>>
>> Dann Taylor
>> Research Analyst
>> Research and Evaluation
>> Evangelical Lutheran Church in America
>> daniel.taylor@elca.org
>> (773) 380-2990
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> LISTSERV@LISTSERV.UGA.EDU (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
>>
>>
>
>


-----
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."

NOTE:  My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
--
View this message in context:
http://old.nabble.com/ISO-country-codes-syntax-tp28913007p28918213.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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

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