sql

Poprawność numeru PESEL w SQL

Wednesday, November 19th, 2008 | Data Mining | No Comments

Algorytm znalazłem na stronie:
http://wipos.p.lodz.pl/zylla/ut/pesel.html

W pierwszym kroku tworzę tabelę tymczasową zapisując w kolumnach kolejne cyfry numeru pesel,

W drugim kroku tworzę tabelę z listą numerów oraz wynikiem testu.

proc sql;
create table pesele_temp as select
id,
pesel,
input(substr(trim(pesel),1,1),commax1.) as a1,
input(substr(trim(pesel),2,1),commax1.) as a2,
input(substr(trim(pesel),3,1),commax1.) as a3,
input(substr(trim(pesel),4,1),commax1.) as a4,
input(substr(trim(pesel),5,1),commax1.) as a5,
input(substr(trim(pesel),6,1),commax1.) as a6,
input(substr(trim(pesel),7,1),commax1.) as a7,
input(substr(trim(pesel),8,1),commax1.) as a8,
input(substr(trim(pesel),9,1),commax1.) as a9,
input(substr(trim(pesel),10,1),commax1.) as a10,
input(substr(trim(pesel),11,1),commax1.) as a11
from tabela
;quit;

proc sql;
create table pesele_v as select
id,
pesel,
ifn (mod( a1 * 9 +
a2 * 7 +
a3 * 3 +
a4 * 1 +
a5 * 9 +
a6 * 7 +
a7 * 3 +
a8 * 1 +
a9 * 9 +
a10* 7
,10)=a11, 1, 0) as TEST
from pesele_temp
;quit;

Tags: ,

Na początek garść linków

Wednesday, October 15th, 2008 | SAS | No Comments

SAS

http://www.sascommunity.org/wiki/Sasopedia

http://www.sas.com/

http://www2.sas.com/proceedings/forum2008/TOC.html

http://support.sas.com/cdlsearch?ct=80000

http://www.utstat.utoronto.ca/mikevans/manuals/evanssasman.pdf - Manudal SAS w PDF

http://www.ats.ucla.edu/stat/sas/library/SASTranMan_os.html

Excel

http://www.goldenline.pl/forum/fani-excela

Text mining

http://www.stat.psu.edu/online/program/index.html- Kurs statystyki stosowanej - Polecam!

http://www.bitcetera.com/assets/media/regex_in_a_nutshell.pdf- Wyrażenia regularne, przyda się na każdym biurku :)

Tags: , , ,

Search