|
|
|
|
************************************************************************************************************
|
|
|
|
|
* Trouve : trouve le nom d'un commune ou d'un canton de la r<>gion centre en indiquant son code
|
|
|
|
|
*
|
|
|
|
|
* Version 1.1: 16 aout 2004
|
|
|
|
|
*
|
|
|
|
|
* Jean-benoit Hardouin, Observatoire R<>gional de la Sant<6E> du Centre - Orl<72>ans - France
|
|
|
|
|
* jean-benoit.hardouin@neuf.fr
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2004 Jean-Benoit Hardouin
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
*
|
|
|
|
|
************************************************************************************************************
|
|
|
|
|
program define trouve,rclass
|
|
|
|
|
version 7.0
|
|
|
|
|
syntax anything
|
|
|
|
|
local nbarg:word count `anything'
|
|
|
|
|
capture su *
|
|
|
|
|
if _rc==0 {
|
|
|
|
|
tempfile savetrouve
|
|
|
|
|
qui save `savetrouve',replace
|
|
|
|
|
}
|
|
|
|
|
preserve
|
|
|
|
|
|
|
|
|
|
numlist "`anything'"
|
|
|
|
|
local list `r(numlist)'
|
|
|
|
|
|
|
|
|
|
foreach i of numlist `list' {
|
|
|
|
|
if (`i'>1800&`i'<1900)|(`i'>2800&`i'<2900)|(`i'>3600&`i'<3800)|(`i'>4100&`i'<4200)|(`i'>4500&`i'<4600) {
|
|
|
|
|
qui use "C:\ado\PERSONAL\files\cantons" ,clear
|
|
|
|
|
qui su id if codepct==`i'
|
|
|
|
|
local tmp=r(min)
|
|
|
|
|
local tmp=nompct[`tmp']
|
|
|
|
|
if "`tmp'"!="" {
|
|
|
|
|
di in green "`i' (canton):" in yellow " `tmp'"
|
|
|
|
|
return local trouve`i' "Canton : `tmp'"
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
di in red "Il n'y a pas de canton avec ce numero (`i') dans la region Centre"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if `i'>2400&`i'<2500 {
|
|
|
|
|
local erreur=0
|
|
|
|
|
if `i'==2411 {local name Bourges}
|
|
|
|
|
else if `i'==2412 {local name Vierzon}
|
|
|
|
|
else if `i'==2413 {local name Saint-Amand-Montrond}
|
|
|
|
|
else if `i'==2414 {local name Aubigny-sur-N<>re}
|
|
|
|
|
else if `i'==2421 {local name Chartres}
|
|
|
|
|
else if `i'==2422 {local name Dreux}
|
|
|
|
|
else if `i'==2423 {local name Chateaudun}
|
|
|
|
|
else if `i'==2424 {local name Nogent le Rotrou}
|
|
|
|
|
else if `i'==2431 {local name Chateauroux}
|
|
|
|
|
else if `i'==2432 {local name Le Blanc}
|
|
|
|
|
else if `i'==2433 {local name Issoudun}
|
|
|
|
|
else if `i'==2434 {local name La Chatre}
|
|
|
|
|
else if `i'==2441 {local name Tours}
|
|
|
|
|
else if `i'==2442 {local name Amboise}
|
|
|
|
|
else if `i'==2443 {local name Loches}
|
|
|
|
|
else if `i'==2444 {local name Chinon}
|
|
|
|
|
else if `i'==2451 {local name Blois}
|
|
|
|
|
else if `i'==2452 {local name Vendome}
|
|
|
|
|
else if `i'==2453 {local name Romoranthin-Lanthenay}
|
|
|
|
|
else if `i'==2461 {local name Orleans}
|
|
|
|
|
else if `i'==2462 {local name Montargis}
|
|
|
|
|
else if `i'==2463 {local name Pithiviers}
|
|
|
|
|
else if `i'==2464 {local name Gien}
|
|
|
|
|
else {
|
|
|
|
|
di in red "Il n'y a pas de zone d'emploi avec ce numero (`i') dans la region Centre"
|
|
|
|
|
local erreur=1
|
|
|
|
|
}
|
|
|
|
|
if `erreur'==0 {
|
|
|
|
|
di in green "`i' (zone d'emploi):" in yellow " `name'"
|
|
|
|
|
return local trouve`i' "Zone d'emploi : `name'"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if `i'>10000&`i'<100000 {
|
|
|
|
|
qui use "C:\ado\PERSONAL\files\communes" ,clear
|
|
|
|
|
qui su id if codecom==`i'
|
|
|
|
|
local tmp=r(min)
|
|
|
|
|
local tmp=nomcom[`tmp']
|
|
|
|
|
if "`tmp'"!="" {
|
|
|
|
|
di in green "`i' (commune):" in yellow " `tmp'"
|
|
|
|
|
return local trouve`i' "Commune : `tmp'"
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
di in red "Il n'y a pas de commune avec ce numero (`i') dans la region Centre"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
di in red "Ce code n'est pas utilisable"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
restore,not
|
|
|
|
|
qui drop _all
|
|
|
|
|
if "`savetrouve'"!="" {
|
|
|
|
|
qui use `savetrouve'
|
|
|
|
|
}
|
|
|
|
|
end
|