/*.................priprav......................................*/ /* spolecne programy */ /* cetnosti, tvosou, upravso, glmas, sestrod, precis....*/ /* 16.9.2003 */ /*..................CETNOSTI.....................................*/ /*................cetnosti udaju masny skot */ /*...............provereni udaju v souborech uzitkovosti a puvodu */ /* navazujici programy */ /* BLUP: REML: */ /* ARj x rozbajeni */ /* FOX prevod do textaku, format SDF */ /* cetcast */ /*..................CETNOSTI ........cetnosti */ /* . TVOSOU tvosou */ /* . UPRAVSO upravso2va */ /* priprav . GLMAS */ /* . SESTROD sestrod2va */ /* . PRECIS precis2va */ /* kompmas.xls */ /* KOVARIANCE kovariance */ /* BLUP REML */ /* . ctevys */ /* . ROZVYS */ /* hodnoc . PREVOD */ /* . REZPROM */ /* . PHkor */ /* (korstab) */ /*..................................... 10.11.2002..Josef Pribyl............*/ dm output 'clear'; dm log 'clear'; /*....cte...*/ filename otel 'd:/pp/phmas93/pp.txt'; filename hm12 'd:/pp/phmas93/r120.txt'; filename hm21 'd:/pp/phmas93/r210.txt'; filename hm36 'd:/pp/phmas93/r365.txt'; filename puv 'd:/pp/phmas93/pu.txt'; /*..zapisuje soubory s pochybnymi radky souboru */ filename choteln 'd:/pp/phmas93/choteln'; filename chotelo 'd:/pp/phmas93/chotelo'; filename chh12n 'd:/pp/phmas93/chh12n'; filename chh12r 'd:/pp/phmas93/chh12r'; filename chh21n 'd:/pp/phmas93/chh21n'; filename chh21r 'd:/pp/phmas93/chh21r'; filename chh36n 'd:/pp/phmas93/chh36n'; filename chh36r 'd:/pp/phmas93/chh36r'; /*.. zapisuje s¨cetnosti podlus kupin...*/ filename cevrnar 'd:/pp/phmas93/cevrnar'; filename cevr120 'd:/pp/phmas93/cevr120'; filename cevr210 'd:/pp/phmas93/cevr210'; filename cevr365 'd:/pp/phmas93/cevr365'; /*.. zapis chybneho puvodu...*/ filename shodj 'd:/pp/phmas93/shodj'; filename shotma 'd:/pp/phmas93/shotma'; /*......................oprava vstupnich dat podle pripominek...............*/ /*.otel....*/ data a; infile otel missover; input /*....... t $ o $ m $ z $ p $ po $ pm $ ch $ poh $ vr $ dat $ ve $ hn $ obt $ ; ..........*/ t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hn $ 48-50 obt $ 51; if t= 170074 then z= 13 ; if t= 50875 then do;o= 94609; m= 0 ;end; if t= 205896 then do;o= 222139; m= 0;end; if t= 227600 then do;o= 229298; m= 239143;end; if t= 69033 then do;o= 233285; m= 239144;end; if t= 227609 then do;o= 227462; m= 239145;end; if t= 49107 then do;o= 239146; m= 236644;end; if t= 225629 then do;o= 239147; m= 95535;end; if t= 227148 then do;o= 239147; m= 134623;end; if t= 227161 then do;o= 239147; m= 64439; end; if t= 227387 then do;o= 239147; m= 17425;end; if t= 227785 then do;o= 239147; m= 121169;end; if t= 227828 then do;o= 239147; m= 39077;end; if t= 231501 then do;o= 239147; m= 202712;end; if t= 233000 then do;o= 231500; m= 239149;end; if t= 237249 then do;o= 20008 ; m= 239148;end; if t= 0 then delete; file otel; put t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hn $ 48-50 obt $ 51; /*........120...*/ data a; infile hm12 missover; input /*..............t $ o $ m $ z $ p $ po $ pm $ ch $ poh $ vr $ dat $ ve $ hn $ h12 $ ; poh $ vr $ dat $ ve $ hn $ obt $ ; ..........*/ t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hn $ 48-50 h12 $ 51-53; if t= 170074 then z= 13 ; if t= 50875 then do;o= 94609; m= 0 ;end; if t= 205896 then do;o= 222139; m= 0;end; if t= 227600 then do;o= 229298; m= 239143;end; if t= 69033 then do;o= 233285; m= 239144;end; if t= 227609 then do;o= 227462; m= 239145;end; if t= 49107 then do;o= 239146; m= 236644;end; if t= 225629 then do;o= 239147; m= 95535;end; if t= 227148 then do;o= 239147; m= 134623;end; if t= 227161 then do;o= 239147; m= 64439; end; if t= 227387 then do;o= 239147; m= 17425;end; if t= 227785 then do;o= 239147; m= 121169;end; if t= 227828 then do;o= 239147; m= 39077;end; if t= 231501 then do;o= 239147; m= 202712;end; if t= 233000 then do;o= 231500; m= 239149;end; if t= 237249 then do;o= 20008 ; m= 239148;end; if t= 0 then delete; if t= 59721 then do; hn=35; h12= 161; end; file hm12 ; put t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hn $ 48-50 h12 $ 51-53; /*....Hmotnost ve 210 dnech...*/ data a; infile hm21 missover; input /*.........t $ o $ m $ z $ p $ po $ pm $ ch $ poh $ vr $ dat $ ve $ hn $ h21 $ ;...........*/ t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hn $ 48-50 h21 $ 51-53; if t= 170074 then z= 13 ; if t= 50875 then do;o= 94609; m= 0 ;end; if t= 205896 then do;o= 222139; m= 0;end; if t= 227600 then do;o= 229298; m= 239143;end; if t= 69033 then do;o= 233285; m= 239144;end; if t= 227609 then do;o= 227462; m= 239145;end; if t= 49107 then do;o= 239146; m= 236644;end; if t= 225629 then do;o= 239147; m= 95535;end; if t= 227148 then do;o= 239147; m= 134623;end; if t= 227161 then do;o= 239147; m= 64439; end; if t= 227387 then do;o= 239147; m= 17425;end; if t= 227785 then do;o= 239147; m= 121169;end; if t= 227828 then do;o= 239147; m= 39077;end; if t= 231501 then do;o= 239147; m= 202712;end; if t= 233000 then do;o= 231500; m= 239149;end; if t= 237249 then do;o= 20008 ; m= 239148;end; if t= 0 then delete; if t= 163993 then do; hn= 40; h21= 263;end; if t= 164010 then do; hn= 38; h21= 263;end; if t= 164012 then do; hn= 36; h21= 256;end; if t= 164013 then do; hn= 38; h21= 223;end; if t= 187619 then do; hn= 27; h21= 233;end; file hm21; put t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hn $ 48-50 h21 $ 51-53; /*....Hmotnost v 365 dnech...*/ data a; infile hm36 missover; input /*.......t $ o $ m $ z $ p $ po $ pm $ ch $ poh $ vr $ dat $ ve $ hn $ h36 $ ;..............*/ t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hn $ 48-50 h36 $ 51-53; if t= 170074 then z= 13 ; if t= 50875 then do;o= 94609; m= 0 ;end; if t= 205896 then do;o= 222139; m= 0;end; if t= 227600 then do;o= 229298; m= 239143;end; if t= 69033 then do;o= 233285; m= 239144;end; if t= 227609 then do;o= 227462; m= 239145;end; if t= 49107 then do;o= 239146; m= 236644;end; if t= 225629 then do;o= 239147; m= 95535;end; if t= 227148 then do;o= 239147; m= 134623;end; if t= 227161 then do;o= 239147; m= 64439; end; if t= 227387 then do;o= 239147; m= 17425;end; if t= 227785 then do;o= 239147; m= 121169;end; if t= 227828 then do;o= 239147; m= 39077;end; if t= 231501 then do;o= 239147; m= 202712;end; if t= 233000 then do;o= 231500; m= 239149;end; if t= 237249 then do;o= 20008 ; m= 239148;end; if t= 0 then delete; if t= 22781 then do; hn= 20; h36= 380 ; end; if t= 39160 then do; hn= 38; h36= 405; end; if t= 40957 then do; hn= 37; h36= 366; end; if t= 130082 then do; hn= 43; h36= 389; end; if t= 163985 then do; hn= 30; h36= 272; end; if t= 163988 then do; hn= 30; h36= 290; end; if t= 163996 then do; hn= 34; h36= 336; end; if t= 195637 then do; hn= 34; h36= 415; end; file hm36; put t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hn $ 48-50 h36 $ 51-53; /*....puvod.....*/ data a; infile puv; input t $ 1-6 o $ 7-12 m $ 13-18; if t= 50875 then do;o= 94609; m= 0 ;end; if t= 205896 then do;o= 222139; m= 0;end; if t= 227600 then do;o= 229298; m= 239143;end; if t= 69033 then do;o= 233285; m= 239144;end; if t= 227609 then do;o= 227462; m= 239145;end; if t= 49107 then do;o= 239146; m= 236644;end; if t= 225629 then do;o= 239147; m= 95535;end; if t= 227148 then do;o= 239147; m= 134623;end; if t= 227161 then do;o= 239147; m= 64439; end; if t= 227387 then do;o= 239147; m= 17425;end; if t= 227785 then do;o= 239147; m= 121169;end; if t= 227828 then do;o= 239147; m= 39077;end; if t= 231501 then do;o= 239147; m= 202712;end; if t= 233000 then do;o= 231500; m= 239149;end; if t= 237249 then do;o= 20008 ; m= 239148;end; if t= 0 then delete; file puv; put t $ 1-6 o $ 7-12 m $ 13-18; /*.................................................NAROZENI............................*/ data a; infile otel missover; input /*....... t $ o $ m $ z $ p $ po $ pm $ ch $ poh $ vr $ dat $ ve $ hn $ obt $ ; ..........*/ t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hn $ 48-50 obt $ 51; tele=t*1; if tele=0 then tele = .; if tele=. then delete; otc=o*1;if otc=0 then otc = .; mat=m*1;if mat=0 then mat = .; zem=z*1;if zem=0 then zem = .; plet=p*1;if plet=0 then plet = .; plo=po*1;if plo=0 then plo = .; plm=pm*1;if plm=0 then plm = .; chov=ch*1;if chov=0 then chov = .; pohl=poh*1;if pohl=0 then pohl = .; vrst=vr*1; if vrst=0 then vrst = .; datn=dat*1; if datn=0 then datn = .; rok=int(datn/10000); if rok=0 then rok = .; mes= int((datn-(rok*10000))/100); if mes =0 then mes = .; den=datn - (rok*10000) - (mes*100); if den = 0 then den = .; vekm=ve*1; if vekm=0 then vekm = .; hnar = hn*1; obtp = obt*1; if hnar= 0 then hnar = .; if obtp= 0 then obtp = .; /*...dodatek..??...*/ keep tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar obtp; file choteln; /*..zapis extremnich hodnot..*/ if 15>hnar or hnar>80 then do; rad=_n_; put rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar obtp; end; file chotelo; if 1>obtp or obtp>4 then do; rad=_n_; put rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar obtp; end; proc means;title "prumery soubor prubeh porodu"; proc freq;tables zem;title "porody podle zemi puvodu"; proc freq;tables plet;title "porody podle plemene telete"; proc freq;tables plo;title "porody podle plemene otce"; proc freq;tables plm;title "porody podle plemene matky"; proc sort data=a;by chov ; proc means noprint; by chov ; output out=pru mean=; /*..cetnosti a prumery podle chovu..*/ data b; set pru; n=_freq_; keep chov n hnar obtp; proc means data=b;title "porody prumery podle chovu"; proc freq data =a;tables pohl;title "porody cetnosti podle pohlavi"; proc sort data=a;by vrst ; proc means noprint; by vrst ; output out=pru mean=; /*..cetnosti a prumery podle SRO..*/ data b; set pru; n=_freq_; keep vrst n hnar obtp; proc means data=b;title "porody prumery podle skupin vrstevniku"; proc sort; by n; data b; set b; file cevrnar; put vrst n hnar obtp; proc freq; tables n; title "porody cetnosti podle skupin vrstevniku"; /*.....proc print;title "porody cetnosti podle skupin vrstevniku";....*/ proc freq data=a;tables vekm;title "porody cetnosti podle veku matky"; data a; infile choteln missover; /*.. tisk extremnich hodnot..*/ input rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar obtp; /*........ proc print;title "porody pochybne radky v souboru pro vahu telat";.....*/ data a; infile chotelo missover; input rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar obtp; /*...proc print;title "porody pochybne radky v souboru pro prubeh porodu";...*/ /*............................................120......................................*/ data a; infile hm12 missover; input /*..............t $ o $ m $ z $ p $ po $ pm $ ch $ poh $ vr $ dat $ ve $ hn $ h12 $ ; poh $ vr $ dat $ ve $ hn $ obt $ ; ..........*/ t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hn $ 48-50 h12 $ 51-53; tele=t*1; if tele=0 then tele = .;if tele = . then delete; otc=o*1;if otc=0 then otc = .; mat=m*1;if mat=0 then mat = .; zem=z*1;if zem=0 then zem = .; plet=p*1;if plet=0 then plet = .; plo=po*1;if plo=0 then plo = .; plm=pm*1;if plm=0 then plm = .; chov=ch*1;if chov=0 then chov = .; pohl=poh*1;if pohl=0 then pohl = .; vrst=vr*1; if vrst=0 then vrst = .; datn=dat*1; if datn=0 then datn = .; rok=int(datn/10000); if rok=0 then rok = .; mes= int((datn-(rok*10000))/100); if mes =0 then mes = .; den=datn - (rok*10000) - (mes*100); if den = 0 then den = .; vekm=ve*1; if vekm=0 then vekm = .; hnar = hn*1; h120 = h12*1; if hnar= 0 then hnar = .; if h120= 0 then h120 = .; keep tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h120; file chh12n; /*..zapis extremnich hodnot..*/ if 15>hnar or hnar>80 then do; rad=_n_; put rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h120; end; file chh12r; if 80>h120 or h120>360 then do; rad=_n_; put rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h120; end; proc means;title "prumery soubor 120"; proc freq;tables zem; title "cetnosti soubor 120 podle zeme puvodu"; proc freq;tables plet;title "cetnosti soubor 120 podle plemene telete"; proc freq;tables plo;title "cetnosti soubor 120 podle plemene otce"; proc freq;tables plm;title "cetnosti soubor 120 podle plemene matky"; proc sort data=a;by chov ; proc means noprint; by chov ; output out=pru mean=; /*.. cetnosti a prumery podle chovu..*/ data b; set pru; n=_freq_; keep chov n hnar h120; proc means data=b;title "prumery soubor 120 podle chovu"; proc freq data =a;tables pohl;title "cetnosti soubor 120 podle pohlavi"; proc sort data=a;by vrst ; proc means noprint; by vrst ; output out=pru mean=; /*..cetnosti a prumery podle SRO..*/ data b; set pru; n=_freq_; keep vrst n hnar h120; proc means data=b;title "prumery soubor 120 podle skupin vrstevniku"; proc sort; by n;data b; set b; file cevr120; put vrst n hnar h120; proc freq; tables n; title "vaha 120 cetnosti podle skupin vrstevniku"; /*....proc print;title "cetnosti soubor 120 podle skupin vrstevniku";.......*/ proc freq data=a;tables vekm;title "cetnosti soubor 120 podle veku matek"; data a; infile chh12n missover; /*.. tisk extremnich hodnot..*/ input rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h120; /*.... proc print;title "pochybne radky soubor 120 pro vahu pri narozeni";....*/ data a; infile chh12r missover; input rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h120; /*.... proc print;title "pochybne radky soubor 120 pro vahu ve 120";.......*/ /*..............................................210....................................*/ data a; infile hm21 missover; input /*.........t $ o $ m $ z $ p $ po $ pm $ ch $ poh $ vr $ dat $ ve $ hn $ h21 $ ;...........*/ t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hn $ 48-50 h21 $ 51-53; tele=t*1; if tele=0 then tele = .;if tele = . then delete; otc=o*1;if otc=0 then otc = .; mat=m*1;if mat=0 then mat = .; zem=z*1;if zem=0 then zem = .; plet=p*1;if plet=0 then plet = .; plo=po*1;if plo=0 then plo = .; plm=pm*1;if plm=0 then plm = .; chov=ch*1;if chov=0 then chov = .; pohl=poh*1;if pohl=0 then pohl = .; vrst=vr*1; if vrst=0 then vrst = .; datn=dat*1; if datn=0 then datn = .; rok=int(datn/10000); if rok=0 then rok = .; mes= int((datn-(rok*10000))/100); if mes =0 then mes = .; den=datn - (rok*10000) - (mes*100); if den = 0 then den = .; vekm=ve*1; if vekm=0 then vekm = .; hnar = hn*1; h210 = h21*1 ; if hnar= 0 then hnar = .; if h210= 0 then h210 = .; keep tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h210; file chh21n; /*.. zapis extremnich hodnot..*/ if 15>hnar or hnar>80 then do; rad=_n_; put rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h210; end; file chh21r; if 130>h210 or h210>550 then do; rad=_n_; put rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h210; end; proc means;title "soubor 210 prumery"; proc freq;tables zem;title "soubor 210 cetnosti podle zeme puvodu"; proc freq;tables plet;title "soubor 210 cetnosti podle plemene telete"; proc freq;tables plo;title "soubor 210 cetnosti podle plemene otce"; proc freq;tables plm;title "soubor 210 cetnosti podle plemene matek"; proc sort data=a;by chov ; proc means noprint; by chov ; output out=pru mean=; /*..cetnosti podle chovu..*/ data b; set pru; n=_freq_; keep chov n hnar h210; proc means data=b;title "soubor 210 prumery podle chovu"; proc freq data =a;tables pohl;title "soubor 210 cetnosti podle pohlavi"; proc sort data=a;by vrst ; proc means noprint; by vrst ; output out=pru mean=; /*.. cetnosti podle SRO..*/ data b; set pru; n=_freq_; keep vrst n hnar h210; proc means data=b; title "soubor 210 prumery podle skupin vrstevniku"; proc sort; by n;data b; set b; file cevr210; put vrst n hnar h210; proc freq; tables n; title "vaha 210 cetnosti podle skupin vrstevniku"; /*.....proc print;title "soubor 210 cetnosti podle skupin vrstevniku";.......*/ proc freq data=a;tables vekm;title "soubor 210 cetnosti podle veku matek"; data a; infile chh21n missover; /*..tisk extremnich hodnot..*/ input rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h210; /*....proc print;title "pochybne radky soubor 210 vaha pri narozeni";......*/ data a; infile chh21r missover; input rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h210; /*....proc print;title "pochybne radky soubor 210 vaha 210";....*/ /*..........................................365......................................*/ data a; infile hm36 missover; input /*.......t $ o $ m $ z $ p $ po $ pm $ ch $ poh $ vr $ dat $ ve $ hn $ h36 $ ;..............*/ t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hn $ 48-50 h36 $ 51-53; tele=t*1; if tele=0 then tele = .;if tele = . then delete; otc=o*1;if otc=0 then otc = .; mat=m*1;if mat=0 then mat = .; zem=z*1;if zem=0 then zem = .; plet=p*1;if plet=0 then plet = .; plo=po*1;if plo=0 then plo = .; plm=pm*1;if plm=0 then plm = .; chov=ch*1;if chov=0 then chov = .; pohl=poh*1;if pohl=0 then pohl = .; vrst=vr*1; if vrst=0 then vrst = .; datn=dat*1; if datn=0 then datn = .; rok=int(datn/10000); if rok=0 then rok = .; mes= int((datn-(rok*10000))/100); if mes =0 then mes = .; den=datn - (rok*10000) - (mes*100); if den = 0 then den = .; vekm=ve*1; if vekm=0 then vekm = .; hnar = hn*1 ; h365 = h36*1 ; if hnar= 0 then hnar = .; if h365= 0 then h365 = .; keep tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h365; file chh36n; /*..zapis extremnich hodnot*/ if 15>hnar or hnar>80 then do; rad=_n_; put rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h365; end; file chh36r; if 200>h365 or h365>750 then do; rad=_n_; put rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h365; end; proc means;title "soubor 365 prumery"; proc freq;tables zem;title "soubor 365 cetnosti podle zeme puvodu"; proc freq;tables plet;title "soubor 365 cetnosti podle plemene telete"; proc freq;tables plo;title "soubor 365 cetnosti podle plemene otce"; proc freq;tables plm;title "soubor 365 cetnosti podle plemene matek"; proc sort data=a;by chov ; proc means noprint; by chov ; output out=pru mean=; /*..cetnosti podle chovu..*/ data b; set pru; n=_freq_; keep chov n hnar h365; proc means data=b;title "soubor 365 prumery podle chovu"; proc freq data =a;tables pohl;title "soubor 365 cetnosti podle pohlavi"; proc sort data=a;by vrst ; proc means noprint; by vrst ; output out=pru mean=; /*..cetnosti podle SRO..*/ data b; set pru; n=_freq_; keep vrst n hnar h365; proc means data=b;title "soubor 365 prumery podle skupin vrstevniku"; proc sort; by n;data b; set b; file cevr365; put vrst n hnar h365; proc freq; tables n; title "vaha 365 cetnosti podle skupin vrstevniku"; /*....proc print;title "soubor 365 cetnosti podle skupin vrstevniku";.....*/ proc freq data=a;tables vekm;title "soubor 365 cetnosti podle veku matek"; data a; infile chh36n missover ; /*..tisk extremnich hodnot..*/ input rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h365; /*.. proc print;title "pochybne radky soubor 365 pro vahu pri narozeni";...*/ data a; infile chh36r missover; input rad tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h365; /*... proc print;title "pochybne radky soubor 365 pro vahu 365";....*/ /*.........................................PUVOD......................................*/ data a; infile puv missover ; input /*....t $ o $ m $ ;.............*/ t $ 1-6 o $ 7-12 M $ 13-18 ; tele=t*1; if tele = 0 then delete;if tele = . then delete; rod1=o*1;if rod1=0 then rod1= .; rod2=m*1;if rod2=0 then rod2= .; proc means;title "prumery a rozpeti cisel v rodokmenu"; data o; set a; if tele = . then delete; if rod1=. and rod2= . then delete; /*...porovnani shodnosti rodicu...*/ file shodj; if tele=rod1 or tele=rod2 or rod1=rod2 then do; put tele rod1 rod2; end; data b; infile shodj; input tele rod1 rod2; proc means; title "pocty shodnych jedincu v puvodu"; /*..porovnani stejneho jedince zda zaroven v pozici otce a matky ..*/ data o; set a; if tele= . then delete; if rod1=. then delete; rodi=rod1; telo=tele; keep telo rodi rod1; proc sort; by rodi; data m; set a; if tele=. then delete; if rod2=. then delete; rodi=rod2; telm=tele; keep telm rodi rod2; proc sort; by rodi; data b; merge o m; by rodi; file shotma; if rod1=rod2 then do; put telo telm rodi; end; data a; infile shotma; input telo telm rodi; proc means; title "pocty shodnych jedincu v postaveni otce a matky"; /*..................................................................................*/ run; /*..................TVOSOU.sas...................................*/ /*................tvorba souboru pro jednotlive vlastnosti */ /* navazuje na CETNOSTI */ /*.....................................30.10.2002.........................*/ /*..cteni..*/ filename otel 'd:/pp/phmas93/pp.txt'; filename hm12 'd:/pp/phmas93/r120.txt'; filename hm21 'd:/pp/phmas93/r210.txt'; filename hm36 'd:/pp/phmas93/r365.txt'; filename puv 'd:/pp/phmas93/pu.txt'; /*..zapis..*/ filename rod 'd:/pp/phmas93/rod'; filename obt 'd:/pp/phmas93/obt'; filename nar 'd:/pp/phmas93/nar'; filename v12 'd:/pp/phmas93/v12'; filename vod 'd:/pp/phmas93/vod'; filename vro 'd:/pp/phmas93/vro'; /*.................................................NAROZENI............................*/ data a; infile otel; input t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hnar 48-50 obtp 51; tele=t*1; if tele=0 then tele = .; if tele=. then delete; otc=o*1;if otc=0 then otc = .; mat=m*1;if mat=0 then mat = .; /*...if mat=. then delete; ...*/ zem=z*1;if zem=0 then zem = .; plet=p*1;if plet=0 then plet = .; if plet=. then delete; plo=po*1;if plo=0 then plo = .; plm=pm*1;if plm=0 then plm = .; chov=ch*1;if chov=0 then chov = .; pohl=poh*1;if pohl=0 then pohl = .; if pohl=. then delete; vrst=vr*1; if vrst=0 then vrst = .; if vrst=. then delete; datn=dat*1; if datn=0 then datn = .; if datn =. then delete; rok=int(datn/10000); if rok=0 then rok = .; mes= int((datn-(rok*10000))/100); if mes =0 then mes = .; den=datn - (rok*10000) - (mes*100); if den = 0 then den = .; vekm=ve*1; if vekm=0 then vekm = .; if vekm=. then vekm=2; if hnar= 0 then hnar = .; if obtp= 0 then obtp = .; keep tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar obtp; proc sort; by tele; data b; set a; by tele; if first.tele; proc means; title " prumery udaje narozeni"; data obt; set b; drop hnar; if pohl=1 and obtp=. then obtp=3; if obtp=. then delete; if 1>obtp or obtp>4 then delete; file obt; put tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm obtp; proc means; title " prumery soubor prubeh porodu"; data nar1; set b; drop obtp; if hnar=. then delete; /*... if 20>hnar then hnar=20;......*/ /*..... if hnar>90 then delete;....*/ hnar1= hnar; drop hnar; vrst1=vrst; drop vrst; vekm1=vekm; drop vekm; proc means; title " prumery soubor vaha narozeni ze souboru narozeni"; /*............................................120......................................*/ data a; infile hm12; input t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hnar 48-50 h120 51-53 ; tele=t*1; if tele=0 then tele = .; if tele=. then delete; otc=o*1;if otc=0 then otc = .; mat=m*1;if mat=0 then mat = .; /*........if mat=. then delete; ........*/ zem=z*1;if zem=0 then zem = .; plet=p*1;if plet=0 then plet = .; if plet=. then delete; plo=po*1;if plo=0 then plo = .; plm=pm*1;if plm=0 then plm = .; chov=ch*1;if chov=0 then chov = .; pohl=poh*1;if pohl=0 then pohl = .; if pohl=. then delete; vrst=vr*1; if vrst=0 then vrst = .; if vrst=. then delete; datn=dat*1; if datn=0 then datn = .; rok=int(datn/10000); if rok=0 then rok = .; mes= int((datn-(rok*10000))/100); if mes =0 then mes = .; den=datn - (rok*10000) - (mes*100); if den = 0 then den = .; vekm=ve*1; if vekm=0 then vekm = .; if vekm=. then vekm=2; if hnar= 0 then hnar = .; if h120= 0 then h120 = .; keep tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h120; proc sort; by tele; data b; set a; by tele; if first.tele; proc means;title " prumery soubor udaje 120"; data v12; set b; drop hnar; if h120=. then delete; /*....if 70>h120 or h120>270 then delete;...*/ file v12; put tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm h120; proc means; title " prumery soubor vaha 120"; data nar2; set b; drop h120; if hnar=. then delete; /*...if 20>hnar then hnar=20;.......*/ /*..... if hnar>90 then delete;....*/ hnar2= hnar; drop hnar; vrst2=vrst*100+zem; drop vrst; vekm2=vekm; drop vekm; proc means; title " prumery soubor vaha narozeni ze souboru 120"; /*..............................................210....................................*/ data a; infile hm21; input t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hnar 48-50 h210 51-53 ; tele=t*1; if tele=0 then tele = .; if tele=. then delete; otc=o*1;if otc=0 then otc = .; mat=m*1;if mat=0 then mat = .; /*........if mat=. then delete; .........*/ zem=z*1;if zem=0 then zem = .; plet=p*1;if plet=0 then plet = .; if plet=. then delete; plo=po*1;if plo=0 then plo = .; plm=pm*1;if plm=0 then plm = .; chov=ch*1;if chov=0 then chov = .; pohl=poh*1;if pohl=0 then pohl = .; if pohl=. then delete; vrst=vr*1; if vrst=0 then vrst = .; if vrst=. then delete; datn=dat*1; if datn=0 then datn = .; rok=int(datn/10000); if rok=0 then rok = .; mes= int((datn-(rok*10000))/100); if mes =0 then mes = .; den=datn - (rok*10000) - (mes*100); if den = 0 then den = .; vekm=ve*1; if vekm=0 then vekm = .; if vekm=. then vekm=2; if hnar= 0 then hnar = .; if h210= 0 then h210 = .; keep tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h210; proc sort; by tele; data b; set a; by tele; if first.tele; proc means;title " prumery soubor udaje 210"; data vod; set b; drop hnar; if h210=. then delete; /*...if 90>h210 or h210>450 then delete;...*/ file vod; put tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm h210; proc means; title " prumery soubor vaha 210"; data nar3; set b; drop h210; if hnar=. then delete; /*....if 20>hnar then hnar=20;....*/ /*...if hnar>90 then delete;....*/ hnar3= hnar; drop hnar; vrst3=vrst*100+zem; drop vrst; vekm3=vekm; drop vekm; proc means; title " prumery soubor vaha narozeni ze souboru 210"; /*..................................365...............................................*/ data a; infile hm36; input t $ 1-6 o $ 7-12 m $ 13-18 z $ 19-20 p $ 21-22 po $ 23-24 pm $ 25-26 ch $ 27-31 poh $ 32-33 vr $ 34-37 dat $ 38-45 ve $ 46-47 hnar 48-50 h365 51-53 ; tele=t*1; if tele=0 then tele = .; if tele=. then delete; otc=o*1;if otc=0 then otc = .; mat=m*1;if mat=0 then mat = .; /*.......if mat=. then delete; .......*/ zem=z*1;if zem=0 then zem = .; plet=p*1;if plet=0 then plet = .; if plet=. then delete; plo=po*1;if plo=0 then plo = .; plm=pm*1;if plm=0 then plm = .; chov=ch*1;if chov=0 then chov = .; pohl=poh*1;if pohl=0 then pohl = .; if pohl=. then delete; vrst=vr*1; if vrst=0 then vrst = .; if vrst=. then delete; datn=dat*1; if datn=0 then datn = .; rok=int(datn/10000); if rok=0 then rok = .; mes= int((datn-(rok*10000))/100); if mes =0 then mes = .; den=datn - (rok*10000) - (mes*100); if den = 0 then den = .; vekm=ve*1; if vekm=0 then vekm = .; if vekm=. then vekm=2; if hnar= 0 then hnar = .; if h365= 0 then h365 = .; keep tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar h365; proc sort; by tele; data b; set a; by tele; if first.tele; proc means; title " prumery soubor udaje 365"; data vro; set b; drop hnar; if h365=. then delete; /*...if 150>h365 or h365>750 then delete;...*/ file vro; put tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm h365; proc means; title " prumery soubor vaha 365"; data nar4; set b; drop h365; if hnar=. then delete; /*...if 20>hnar then hnar=20;....*/ /*...if hnar>90 then delete;....*/ hnar4= hnar; drop hnar; vrst4=vrst*100+zem; drop vrst; vekm4=vekm; drop vekm; proc means; title " prumery soubor vaha narozeni ze souboru 365"; /*.......................spojeni souboru pri narozeni.................................*/ data a; merge nar1 nar2; by tele; data b; merge a nar3; by tele; data a; merge b nar4; by tele; /*..SRO podle souboru narozeni..*/ vrst= vrst1; if vrst = . then vrst = vrst2 + 100000; if vrst = . then vrst = vrst3 + 200000; if vrst = . then vrst = vrst4 + 300000; drop vrst1 vrst2 vrst3 vrst4; vekm=vekm1; if vekm = . then vekm = vekm2; if vekm = . then vekm = vekm3; if vekm = . then vekm = vekm4; drop vekm1 vekm2 vekm3 vekm4; hnar=hnar1; if hnar = . then hnar = hnar2; if hnar = . then hnar = hnar3; if hnar = . then hnar = hnar4; drop hnar1 hnar2 hnar3 hnar4; proc means;title " prumery cely soubor vaha narozeni "; proc freq; tables vekm; title " cetnosti podsouboru vaha narozeni podle veku matky"; proc sort; by tele; data nar; set a; by tele; if first.tele; file nar; put tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm hnar; proc means; title " konecny soubor narozeni"; proc freq; tables vekm; title " cetnosti konecny soubor vaha narozeni podle veku matky"; /*.........................................PUVOD......................................*/ data a; infile puv; input t $ 1-6 o $ 7-12 m $ 13-18; tele=t*1; if tele=0 then delete; if tele = . then delete; rod1=o*1; if rod1=0 then rod1= .; rod2=m*1; if rod2=0 then rod2= .; keep tele rod1 rod2; proc means;title " nacteny soubor puvodu"; proc sort; by tele; data b; set a; by tele; if first.tele; proc means;title " nacteny soubor puvodu, kazde tele pouze jednou"; /*...............spojeni vsech puvodu podle telat...................................*/ data a; merge b obt; by tele; keep tele rod1 rod2 o m pt po pm ; o=otc; m=mat; pt=plet; po=plo; pm=plm; data b; merge a nar; by tele; keep tele rod1 rod2 o m pt po pm ; if o=. then o=otc; if m=. then m=mat; if pt=. then pt=plet; if po=. then po=plo; if pm=. then pm=plm; data a; merge b v12; by tele; keep tele rod1 rod2 o m pt po pm ; if o=. then o=otc; if m=. then m=mat; if pt=. then pt=plet; if po=. then po=plo; if pm=. then pm=plm; data b; merge a vod; by tele; keep tele rod1 rod2 o m pt po pm ; if o=. then o=otc; if m=. then m=mat; if pt=. then pt=plet; if po=. then po=plo; if pm=. then pm=plm; data a; merge b vro; by tele; keep tele rod1 rod2 o m pt po pm ; if o=. then o=otc; if m=. then m=mat; if pt=. then pt=plet; if po=. then po=plo; if pm=. then pm=plm; proc means;title "spojeni vsech puvodu podle telat"; /*............................pridani do puvodu - matky......................... */ data c; set obt; tele= mat; plet= plm; keep tele plet; proc sort; by tele; data d; set c; by tele; if first.tele; data b; merge a d; by tele; keep tele rod1 rod2 o m pt po pm ; if pt=. then pt= plet; data c; set nar; tele= mat; plet= plm; keep tele plet; proc sort; by tele; data d; set c; by tele; if first.tele; data a; merge b d; by tele; keep tele rod1 rod2 o m pt po pm ; if pt=. then pt= plet; data c; set v12; tele= mat; plet= plm; keep tele plet; proc sort; by tele; data d; set c; by tele; if first.tele; data b; merge a d; by tele; keep tele rod1 rod2 o m pt po pm ; if pt=. then pt= plet; data c; set vod; tele= mat; plet= plm; keep tele plet; proc sort; by tele; data d; set c; by tele; if first.tele; data a; merge b d; by tele; keep tele rod1 rod2 o m pt po pm ; if pt=. then pt= plet; data c; set vro; tele= mat; plet= plm; keep tele plet; proc sort; by tele; data d; set c; by tele; if first.tele; data b; merge a d; by tele; keep tele rod1 rod2 o m pt po pm ; if pt=. then pt= plet; proc means;title "pridani do puvodu - matky"; /*...........................pridani do puvodu - otci ..............*/ data c; set obt; tele= otc; plet= plo; keep tele plet; proc sort; by tele; data d; set c; by tele; if first.tele; data a; merge b d; by tele; keep tele rod1 rod2 o m pt po pm ; if pt=. then pt= plet; data c; set nar; tele= otc; plet= plo; keep tele plet; proc sort; by tele; data d; set c; by tele; if first.tele; data b; merge a d; by tele; keep tele rod1 rod2 o m pt po pm ; if pt=. then pt= plet; data c; set v12; tele= otc; plet= plo; keep tele plet; proc sort; by tele; data d; set c; by tele; if first.tele; data a; merge b d; by tele; keep tele rod1 rod2 o m pt po pm ; if pt=. then pt= plet; data c; set vod; tele= otc; plet= plo; keep tele plet; proc sort; by tele; data d; set c; by tele; if first.tele; data b; merge a d; by tele; keep tele rod1 rod2 o m pt po pm ; if pt=. then pt= plet; data c; set vro; tele= otc; plet= plo; keep tele plet; proc sort; by tele; data d; set c; by tele; if first.tele; data a; merge b d; by tele; keep tele rod1 rod2 o m pt po pm ; if pt=. then pt= plet; proc means; title "nahrubo sestavene puvody vcetne otcu"; /*........doplneni rodicu v puvodu ..........*/ data c; set a; if o=. and rod1 ne . and rod1 ne m then o=rod1; else if o=. and rod2 ne . and rod2 ne m then o=rod2; if m=. and rod1 ne . and rod1 ne o then m=rod1; else if m=. and rod2 ne . and rod2 ne o then m=rod2; file rod; put tele o m pt po pm ; proc means;title "opravene puvody"; /*..................................................................................*/ run; /*..................UPRAVSO.sas...................................*/ /*................upravuje soubory, shlukuje tridy veku, pohlavi */ /* zavadi promennou TPM a doplnuje o tuto promennou rodokmen. */ /* zavadi heterozi a doplnuje do datoveho souboru */ /* navazuje na TVOSOU */ /*.....................................30.10.2002.........................*/ /*..cte..*/ filename rod 'd:/pp/phmas93/rod'; filename obt 'd:/pp/phmas93/obt'; filename nar 'd:/pp/phmas93/nar'; filename v12 'd:/pp/phmas93/v12'; filename vod 'd:/pp/phmas93/vod'; filename vro 'd:/pp/phmas93/vro'; /*..zapisuje..*/ filename rodok 'd:/pp/phmas93/rodok'; filename uzitk 'd:/pp/phmas93/uzitk'; /*...........................................cteni.souboru............................*/ data obt; infile obt; input tele otc mat zem plet plo plm chov pohl vrst rok mes den vekm obtp; proc means;title "cteni souboru prubeh porodu"; proc sort; by tele; data nar; infile nar; input tele otc1 mat1 zem1 plet1 plo1 plm1 chov1 pohl1 vrst1 rok1 mes1 den1 vekm1 hnar; proc means;title "cteni souboru vaha nar"; proc sort; by tele; data a; merge obt nar; by tele; if mat = . then mat=mat1; if otc = . then otc=otc1; if plet=. then plet=plet1; if plm=. then plm=plm1; if pohl=. then pohl=pohl1; vrstpp=vrst; vrstna=vrst1; if vekm=. or vekm=2 and vekm1 ne . then vekm=vekm1; keep tele mat otc plet plm pohl vrstpp vrstna vekm obtp hnar; data v12; infile v12; input tele otc1 mat1 zem1 plet1 plo1 plm1 chov1 pohl1 vrst1 rok1 mes1 den1 vekm1 h12; proc means; title "cteni souboru vaha 120";proc sort; by tele; data b; merge a v12; by tele; if mat = . then mat=mat1; if otc = . then otc=otc1; if plet=. then plet=plet1; if plm=. then plm=plm1; if pohl=. then pohl=pohl1; vr12=vrst1; if vekm=. or vekm=2 and vekm1 ne . then vekm=vekm1; keep tele mat otc plet plm pohl vrstpp vrstna vr12 vekm obtp hnar h12; data vod; infile vod; input tele otc1 mat1 zem1 plet1 plo1 plm1 chov1 pohl1 vrst1 rok1 mes1 den1 vekm1 hod; proc means;title "cteni souboru vaha 210"; proc sort; by tele; data a; merge b vod; by tele; if mat = . then mat=mat1; if otc = . then otc=otc1; if plet=. then plet=plet1; if plm=. then plm=plm1; if pohl=. then pohl=pohl1; vrod=vrst1; if vekm=. or vekm=2 and vekm1 ne . then vekm=vekm1; keep tele mat otc plet plm pohl vrstpp vrstna vr12 vrod vekm obtp hnar h12 hod; data vro; infile vro; input tele otc1 mat1 zem1 plet1 plo1 plm1 chov1 pohl1 vrst1 rok1 mes1 den1 vekm1 hro; proc means; title "cteni souboru vaha rok";proc sort; by tele; /*........cely soubor......*/ data b; merge a vro; by tele; if mat = . then mat=mat1; if otc = . then otc=otc1; if plet=. then plet=plet1; if plm=. then plm=plm1; if pohl=. then pohl=pohl1; vrok=vrst1; if vekm=. or vekm=2 and vekm1 ne . then vekm=vekm1; keep tele mat otc plet plm pohl vrstpp vrstna vr12 vrod vrok vekm obtp hnar h12 hod hro; proc means;title "prumery cely nacteny soubor"; proc freq; tables vekm;title "cetnosti cely soubor podle veku matek"; data a; set b; if obtp= . then delete; proc freq; tables vekm;title "cetnosti podle veku matek, chybejici prubeh porodu"; data a; set b; if hnar= . then delete; proc freq; tables vekm;title "cetnosti podle veku matek, chybejici vaha nar"; data a; set b; if h12= . then delete; proc freq; tables vekm;title "cetnosti podle veku matek, chybejici vaha 120"; data a; set b; if hod= . then delete; proc freq; tables vekm;title "cetnosti podle veku matek, chybejici vaha 210"; data a; set b; if hro= . then delete; proc freq; tables vekm;title "cetnosti podle veku matek, chybejici vaha rok"; /*.........................uprava obtiznosti teleni....................................*/ data a; set b; if pohl=1 and obtp=. then obtp=3; /*....................uprava pohlavi. do trid...........................................*/ if pohl=1 or pohl=3 or pohl=5 or pohl=7 then pohl=2; if pohl=9 or pohl=11 or pohl=13 then pohl=8; if pohl=6 then pohl=4; if pohl=12 then pohl=10; if pohl=14 then delete; /*....................uprava trvaleho prostredi matky..+ plemena........................*/ tp=mat; obs=_n_; if tp = . then tp = obs + 999999; if vekm=1 then do; plm=5;vekm=4; end; /*....................uprava vekmatky do trid .........+ plemena........................*/ if vekm=2 then do; plm=5; vekm=8; end; if vekm=6 or vekm=7 then vekm=5; if vekm=9 then vekm=8; /*..................dosazeni koeficientu pro heterozi.telete a matky ...................*/ if plet=1 then het=0; if plet=14 then het=1; if plet=15 then het=0.5; if plet=16 then het=0; if plet=2 then het=0.5; if plet=3 then het=1; if plet=4 then het=0.5; if plet=5 then het=0; if plet=17 then het=1; if plet=18 then het=0.5; if plet=19 then het=0; if plet=30 then het=0.5; if plet=31 then het=1; if plet=32 then het=0.5; if plet=33 then het=0; if plet=23 then het=1; if plet=24 then het=0.5; if plet=25 then het=0; if plet=45 then het=1; if plet=46 then het=0.5; if plet=47 then het=0; if plet=42 then het=1; if plet=43 then het=0.5; if plet=44 then het=0; if plet=6 then het=0; if plet=7 then het=0; if plet=8 then het=0; if plet=9 then het=0; if plet=10 then het=0.5; if plet=11 then het=1; if plet=12 then het=0.5; if plet=13 then het=0; if plet=34 then het=0.5; if plet=35 then het=1; if plet=36 then het=0.5; if plet=37 then het=0; if plet=26 then het=0.5; if plet=27 then het=1; if plet=28 then het=0.5; if plet=29 then het=0; if plet=20 then het=1; if plet=21 then het=0.5; if plet=22 then het=0; if plet=38 then het=0.5; if plet=39 then het=1; if plet=40 then het=0.5; if plet=41 then het=0; if plet=48 then het=1; if plet=49 then het=0.5; if plet=50 then het=0; if plm=1 then hep=0; if plm=14 then hep=1; if plm=15 then hep=0.5; if plm=16 then hep=0; if plm=2 then hep=0.5; if plm=3 then hep=1; if plm=4 then hep=0.5; if plm=5 then hep=0; if plm=17 then hep=1; if plm=18 then hep=0.5; if plm=19 then hep=0; if plm=30 then hep=0.5; if plm=31 then hep=1; if plm=32 then hep=0.5; if plm=33 then hep=0; if plm=23 then hep=1; if plm=24 then hep=0.5; if plm=25 then hep=0; if plm=45 then hep=1; if plm=46 then hep=0.5; if plm=47 then hep=0; if plm=42 then hep=1; if plm=43 then hep=0.5; if plm=44 then hep=0; if plm=6 then hep=0; if plm=7 then hep=0; if plm=8 then hep=0; if plm=9 then hep=0; if plm=10 then hep=0.5; if plm=11 then hep=1; if plm=12 then hep=0.5; if plm=13 then hep=0; if plm=34 then hep=0.5; if plm=35 then hep=1; if plm=36 then hep=0.5; if plm=37 then hep=0; if plm=26 then hep=0.5; if plm=27 then hep=1; if plm=28 then hep=0.5; if plm=29 then hep=0; if plm=20 then hep=1; if plm=21 then hep=0.5; if plm=22 then hep=0; if plm=38 then hep=0.5; if plm=39 then hep=1; if plm=40 then hep=0.5; if plm=41 then hep=0; if plm=48 then hep=1; if plm=49 then hep=0.5; if plm=50 then hep=0; proc sort; by tele; proc means ;title "prumery upravene udaje"; proc freq; tables pohl;title "cetnosti podle pohlavi"; proc freq; tables het;title "cetnosti podle heteroz. telat"; proc freq; tables hep;title "cetnosti podle heteroz matek"; data b; set a; by tele; if first.tele; keep tele tp plet plm pohl vrstpp vrstna vr12 vrod vrok het hep vekm obtp hnar h12 hod hro; file uzitk; put tele tp plet plm pohl vrstpp vrstna vr12 vrod vrok het hep vekm obtp hnar h12 hod hro; proc means;title "prumery konecny upraveny soubor"; /*...............................uprava souboru puvodu.................................*/ data pu; infile rod; input tele o m pt po pm ; proc sort; by tele; proc means;title "nactene puvody"; data pu; set pu; by tele; if first.tele; proc means;title "vyhozena opakujici se tela"; data tele; /*....................tele..........................*/ set b; keep tele plet; data a; merge pu tele; by tele; if pt=. then pt=plet; keep tele o m pt po pm; proc means;title "pripojena telata s uzitkovosti"; data tp; /*...................trvale prostredi.................*/ set b; tele = tp; plet= plm; keep tele plet; proc sort; by tele; proc means;title " matky s uzitkovosti"; data b; set tp; by tele; if first.tele; proc means;title "vyhozeny opakujici se matky"; data puv; merge b a; by tele; if pt=. then pt=plet; keep tele o m pt po pm; proc sort; by tele; data bb; set puv; by tele; if first.tele; data puv; set bb; file rodok; put tele o m pt po pm; proc means;title "cely nacteny soubor puvodu"; /*..pocet jedincu s umele dosazenym puvodem..*/ data a; set puv; if tele>999999 then a=1; else a=2; proc freq; tables a;title "cetnost jedincu s umele dosazenym puvodem"; /*..................................................................................*/ run; /*..................GLMAS.........................................*/ /*................vypocet glm pro pevne efekty rust............. */ /* masneho skotu */ /* navazuje na UPRAVSO */ /*.....................................31.3.2002.........................*/ filename rodok 'd:/pp/phmas93/rodok'; filename uzitk 'd:/pp/phmas93/uzitk'; /*...........................................cteni.souboru............................*/ data uzit; infile uzitk; input tele tp plet plm pohl vrstpp vrstna vr12 vrod vrok het hep vekm obtp hnar h12 hod hro; proc means;title "prumery uzikovosti"; /*..................... efekty spolecne pro vsechny vlastnosti .........*/ proc glm; class plet; model obtp hnar h12 hod hro = plet; proc glm; class plm; model obtp hnar h12 hod hro = plm; proc glm; class plet plm; model obtp hnar h12 hod hro = plet plm; proc glm; class pohl; model obtp hnar h12 hod hro = pohl; proc glm; model obtp hnar h12 hod hro = het; proc glm; model obtp hnar h12 hod hro = hep; proc glm; model obtp hnar h12 hod hro = het hep; proc glm; class vekm; model obtp hnar h12 hod hro = vekm; /*....... prubeh porodu .....................................*/ proc sort; by vrstpp; proc glm; absorb vrstpp; model obtp = ; proc glm; absorb vrstpp; model obtp = het; proc glm; absorb vrstpp; model obtp = het hep; proc glm; absorb vrstpp;class pohl; model obtp = pohl het hep; proc glm; absorb vrstpp;class pohl vekm; model obtp = pohl vekm het hep; proc glm; absorb vrstpp; class plet plm pohl vekm; model obtp = plet plm pohl vekm ; /*....... narozeni .....................................*/ proc sort; by vrstna; proc glm; absorb vrstna; model hnar = ; proc glm; absorb vrstna; model hnar = het; proc glm; absorb vrstna; model hnar = het hep; proc glm; absorb vrstna;class pohl; model hnar = pohl het hep; proc glm; absorb vrstna;class pohl vekm; model hnar = pohl vekm het hep; proc glm; absorb vrstna; class plet plm pohl vekm; model hnar = plet plm pohl vekm ; /*....... vaha 120 .....................................*/ data a; set uzit; if h12 = . then delete; proc sort; by vr12; proc glm; absorb vr12; model h12 = ; proc glm; absorb vr12; model h12 = het; proc glm; absorb vr12; model h12 = het hep; proc glm; absorb vr12;class pohl; model h12 = pohl het hep; proc glm; absorb vr12;class pohl vekm; model h12 = pohl vekm het hep; proc glm; absorb vr12; class plet plm pohl vekm; model h12 = plet plm pohl vekm ; /*....... vaha 210 .....................................*/ data a; set uzit; if hod = . then delete; proc sort; by vrod; proc glm; absorb vrod; model hod = ; proc glm; absorb vrod; model hod = het; proc glm; absorb vrod; model hod = het hep; proc glm; absorb vrod;class pohl; model hod = pohl het hep; proc glm; absorb vrod;class pohl vekm; model hod = pohl vekm het hep; proc glm; absorb vrod; class plet plm pohl vekm; model hod = plet plm pohl vekm ; /*....... vaha 365 .....................................*/ data a; set uzit; if hro = . then delete; proc sort; by vrok; proc glm; absorb vrok; model hro = ; proc glm; absorb vrok; model hro = het; proc glm; absorb vrok; model hro = het hep; proc glm; absorb vrok; class pohl; model hro = pohl het hep; proc glm; absorb vrok; class pohl vekm; model hro = pohl vekm het hep; proc glm; absorb vrok; class plet plm pohl vekm; model hro = plet plm pohl vekm ; /*..................................................................................*/ run; /*..................SESTROD...................................*/ /*................doplnuje rodokmen.......................... */ /* navazuje na UPRAVSO */ /*.....................................4.11.2002.........................*/ /*..cte..*/ filename rodok 'd:/pp/phmas93/rodok'; filename uzitk 'd:/pp/phmas93/uzitk'; /*..zapisuje..*/ filename pribuz 'd:/pp/phmas93/prib'; /*........................................................cteni.souboru puvodu.*/ data rodok; infile rodok; input tele o m pt po pm; proc sort; by tele; proc means;title "vstupni rodokmen"; /*............................................... kompletni puvodni rodokmen....*/ data rod; set rodok; by tele; if first.tele; proc means; title "vyhozeni opakovanych telat"; /*.........................................makro prirazovani plemen do puvodu...*/ %macro plemen; %do i=1 %to 10 %by 1; data a; set rod; if pt=. and po=. and pm= . then delete; /*........................doplneni plemen v puvodech.u otcu.- opakovana CTENI...*/ /*...................................cast souboru, kdy neco o plemenech znamo...*/ if po=. and pt=1 then po=1; else if po=. and pt=16 then po=16; else if po=. and pt=14 then po=16; else if po=. and pt=15 then po=16; else if po=. and pt=5 then po=5; else if po=. and pt=3 then po=5; else if po=. and pt=4 then po=5; else if po=. and pt=13 then po=13; else if po=. and pt=19 then po=19; else if po=. and pt=17 then po=19; else if po=. and pt=18 then po=19; else if po=. and pt=33 then po=33; else if po=. and pt=30 then po=33; else if po=. and pt=31 then po=33; else if po=. and pt=32 then po=33; else if po=. and pt=25 then po=25; else if po=. and pt=23 then po=25; else if po=. and pt=24 then po=25; else if po=. and pt=47 then po=47; else if po=. and pt=45 then po=47; else if po=. and pt=46 then po=47; else if po=. and pt=44 then po=44; else if po=. and pt=42 then po=44; else if po=. and pt=43 then po=44; else if po=. and pt=9 then po=9; else if po=. and pt=7 then po=9; else if po=. and pt=8 then po=9; else if po=. and pt=10 then po=13; else if po=. and pt=11 then po=13; else if po=. and pt=12 then po=13; else if po=. and pt=37 then po=37; else if po=. and pt=34 then po=37; else if po=. and pt=35 then po=37; else if po=. and pt=36 then po=37; else if po=. and pt=29 then po=29; else if po=. and pt=26 then po=29; else if po=. and pt=27 then po=29; else if po=. and pt=28 then po=29; else if po=. and pt=22 then po=22; else if po=. and pt=20 then po=22; else if po=. and pt=21 then po=22; else if po=. and pt=41 then po=41; else if po=. and pt=38 then po=41; else if po=. and pt=39 then po=41; else if po=. and pt=40 then po=41; else if po=. and pt=50 then po=50; else if po=. and pt=48 then po=50; else if po=. and pt=49 then po=50; else if po= . then po= 5; proc means; title "DOPLNENI PLEMEN U OTCU"; data b; set a; /*.........................................doplneni plemen v puvodech.u telat...*/ if pt=. and po=1 then pt=1; else if pt=. and po=16 and pm=16 then pt=16; else if pt=. and po=16 and pm=14 then pt=15; else if pt=. and po=16 and pm=15 then pt=16; else if pt=. and po=16 then pt=14; else if pt=. and po=5 and pm=2 then pt=3; else if pt=. and po=5 and pm=3 then pt=4; else if pt=. and po=5 and pm=4 then pt=5; else if pt=. and po=5 then pt=3; else if pt=. and po=13 and pm=13 then pt=13; else if pt=. and po=13 and pm= 5 then pt=11; else if pt=. and po=13 and pm=4 then pt=11; else if pt=. and po=13 and pm=3 then pt=11; else if pt=. and po=13 and pm=6 then pt=11; else if pt=. and po=13 and pm=7 then pt=11; else if pt=. and po=13 and pm=8 then pt=11; else if pt=. and po=13 and pm=9 then pt=12; else if pt=. and po=13 and pm=10 then pt=12; else if pt=. and po=13 and pm=11 then pt=12; else if pt=. and po=13 and pm=12 then pt=13; else if pt=. and po=13 then pt=10; else if pt=. and po=19 and pm=19 then pt=19; else if pt=. and po=19 and pm=17 then pt=18; else if pt=. and po=19 and pm=18 then pt=19; else if pt=. and po=19 then pt=17; else if pt=. and po=33 and pm=33 then pt=33; else if pt=. and po=33 and pm=30 then pt=31; else if pt=. and po=33 and pm=31 then pt=32; else if pt=. and po=33 and pm=32 then pt=33; else if pt=. and po=33 then pt=30; else if pt=. and po=25 and pm=25 then pt=25; else if pt=. and po=25 and pm=23 then pt=24; else if pt=. and po=25 and pm=24 then pt=25; else if pt=. and po=25 then pt=23; else if pt=. and po=47 and pm=47 then pt=47; else if pt=. and po=47 and pm=45 then pt=46; else if pt=. and po=47 and pm=46 then pt=47; else if pt=. and po=47 then pt=45; else if pt=. and po=44 and pm=44 then pt=44; else if pt=. and po=44 and pm=42 then pt=43; else if pt=. and po=44 and pm=43 then pt=44; else if pt=. and po=44 then pt=42; else if pt=. and po=9 and pm=9 then pt=9; else if pt=. and po=9 and pm=7 then pt=8; else if pt=. and po=9 and pm=8 then pt=9; else if pt=. and po=9 then pt=7; else if pt=. and po=37 and pm=34 then pt=35; else if pt=. and po=37 and pm=37 then pt=37; else if pt=. and po=37 and pm=35 then pt=36; else if pt=. and po=37 and pm=36 then pt=37; else if pt=. and po=37 then pt=34; else if pt=. and po=29 and pm=29 then pt=29; else if pt=. and po=29 and pm=26 then pt=27; else if pt=. and po=29 and pm=27 then pt=28; else if pt=. and po=29 and pm=28 then pt=29; else if pt=. and po=29 then pt=26; else if pt=. and po=22 and pm=22 then pt=22; else if pt=. and po=22 and pm=20 then pt=21; else if pt=. and po=22 and pm=21 then pt=22; else if pt=. and po=22 then pt=20; else if pt=. and po=41 and pm=41 then pt=41; else if pt=. and po=41 and pm=38 then pt=39; else if pt=. and po=41 and pm=39 then pt=40; else if pt=. and po=41 and pm=40 then pt=41; else if pt=. and po=41 then pt=39; else if pt=. and po=50 and pm=50 then pt=50; else if pt=. and po=50 and pm=48 then pt=49; else if pt=. and po=50 and pm=49 then pt=50; else if pt=. and po=50 then pt=48; else if pt= . then pt= 5; proc means; title "DOPLNENI PLEMEN U TELAT"; data a; set b; /*.........................................doplneni plemen v puvodech.u matek...*/ if pm=. and pt=1 then pm=1; else if pm=. and po=16 and pt=16 then pm=16; else if pm=. and po=16 and pt=14 then pm=5; else if pm=. and po=16 and pt=15 then pm=14; else if pm=. and po=16 then pm=5; else if pm=. and po=5 and pt=2 then pm=2; else if pm=. and po=5 and pt=3 then pm=2; else if pm=. and po=5 and pt=4 then pm=3; else if pm=. and po=5 then pm=5; else if pm=. and po=13 and pt=13 then pm=13; else if pm=. and po=13 and pt= 5 then do; pm= 5; pt=11; end; else if pm=. and po=13 and pt=4 then do; pm= 4; pt=11; end; else if pm=. and po=13 and pt=3 then do; pm= 3; pt=11; end; else if pm=. and po=13 and pt=11 then pm=5; else if pm=. and po=13 and pt=12 then pm=11; else if pm=. and po=13 then pm=5; else if pm=. and po=19 and pt=19 then pm=19; else if pm=. and po=19 and pt=17 then pm=5; else if pm=. and po=19 and pt=18 then pm=17; else if pm=. and po=19 then pm=5; else if pm=. and po=33 and pt=33 then pm=33; else if pm=. and po=33 and pt=30 then pm=5; else if pm=. and po=33 and pt=31 then pm=5; else if pm=. and po=33 and pt=32 then pm=31; else if pm=. and po=33 then pm=5; else if pm=. and po=25 and pt=25 then pm=25; else if pm=. and po=25 and pt=23 then pm=5; else if pm=. and po=25 and pt=24 then pm=23; else if pm=. and po=25 then pm=5; else if pm=. and po=47 and pt=47 then pm=47; else if pm=. and po=47 and pt=45 then pm=5; else if pm=. and po=47 and pt=46 then pm=45; else if pm=. and po=47 then pm=5; else if pm=. and po=44 and pt=44 then pm=44; else if pm=. and po=44 and pt=42 then pm=5; else if pm=. and po=44 and pt=43 then pm=42; else if pm=. and po=44 then pm=5; else if pm=. and po=9 and pt=9 then pm=9; else if pm=. and po=9 and pt=6 then pm=5; else if pm=. and po=9 and pt=10 then pm=9; else if pm=. and po=9 and pt=7 then pm=5; else if pm=. and po=9 and pt=8 then pm=7; else if pm=. and po=9 then pm=5; else if pm=. and po=37 and pt=37 then pm=37; else if pm=. and po=37 and pt=34 then pm=5; else if pm=. and po=37 and pt=35 then pm=34; else if pm=. and po=37 and pt=36 then pm=35; else if pm=. and po=37 then pm=5; else if pm=. and po=29 and pt=29 then pm=29; else if pm=. and po=29 and pt=26 then pm=5; else if pm=. and po=29 and pt=27 then pm=26; else if pm=. and po=29 and pt=28 then pm=27; else if pm=. and po=29 then pm=5; else if pm=. and po=22 and pt=22 then pm=22; else if pm=. and po=22 and pt=20 then pm=5; else if pm=. and po=22 and pt=21 then pm=20; else if pm=. and po=22 then pm=5; else if pm=. and po=41 and pt=41 then pm=41; else if pm=. and po=41 and pt=38 then pm=5; else if pm=. and po=41 and pt=39 then pm=38; else if pm=. and po=41 and pt=40 then pm=39; else if pm=. and po=41 then pm=5; else if pm=. and po=50 and pt=50 then pm=50; else if pm=. and po=50 and pt=48 then pm=5; else if pm=. and po=50 and pt=49 then pm=480; else if pm=. and po=50 then pm=5; else if pm=. then pm= 5; proc means; title "DOPLNENI PLEMEN U MATEK"; /*.................................................doplnen puvod, Dalsi CTENI...*/ data rodok; set a; data a; set rodok; keep tele plt; plt=pt; data b; set rodok; keep tele plt; tele=o;plt=po; data c; set rodok; keep tele plt; tele=m;plt=pm; data d; set a b c;if tele=. then delete; proc sort; by tele; proc means; data a; set d; by tele; if first.tele; proc means; data b; merge a rodok; by tele; proc means; data c; set b; if pt=. then pt=plt; keep tele o1 m1 pt1 po1 pm1; o1=o;m1=m;pt1=pt;po1=po;pm1=pm; data rodok; merge c rod; by tele; if o=. then o=o1;if m=. then m=m1; if pt=. then pt=pt1;if po=. then po=po1;if pm=. then pm=pm1; keep tele o m pt po pm; data rod; set rodok; proc means; title "DOPLNOVANI UKONCENO"; %end; %mend plemen; /*...........................................zacatek opakujiciho se bloku.......*/ %plemen; /*............................................konec opakujiciho se bloku........*/ data rod; set rodok; if tele=. then delete; proc means;title "rodokmen po iterativnim pridavani plemen"; data rod; set rod; if pt=. and po=. and pm= . then delete; proc means; title "rodokmen po vyhozeni chybejicich plemen"; /* .................. doplneni plemen v rodokmenu (bez uzitkovosti) ukonceno.....*/ data rodok; set rod; if pt=. then pt=5; if po=. then po=5; if pm=. then pm=5; proc means;title "dosazeni pt=5"; data rod; set rodok; /*....................................................cteni.souboru uzitkovost.*/ data uzitk; infile uzitk; input tele tp plet plm pohl vrstpp vrstna vr12 vrod vrok het hep vekm obtp hnar h12 hod hro; proc means;title "cteni souboru uzitkovost"; /*.......................................................................tele..*/ data tele; set uzitk; keep jedin; jedin= tele; /*.............................................................T.Prostredi matky*/ data tp; set uzitk; keep jedin; jedin=tp; /*.....................................................jedinec v uzitkovostech.*/ data jedi; set tele tp; proc sort; by jedin; proc means;title "telata a kravy s uzitkovosti"; data jed; set jedi; by jedin; if first.jedin; tele=jedin; keep tele; proc means; title "telata s uzitkovosti po vyhozeni opakujicich se jedincu"; /*...........................zadani makra predci..................................*/ %macro predci; %do i=1 %to 10 %by 1; data prve; merge jed(in=prv) rodok; by tele; if prv; keep tele o m; data a; set prve; keep tele; data b; set prve; keep tele; tele= o; data c; set prve; keep tele; tele= m; data tele; set a b c; proc sort; by tele; proc means; data jed; set tele; by tele; if first.tele; proc means; %end; %mend predci; /* prva generace predku.prirateni puvodu k uzitkovostem - telatum a trv. prostredi*/ /*..blok opakovane nacitani generaci predku..*/ %predci; /*.........................................konec bloku pridavani generaci predku..*/ data druh; merge jed(in=sed) rodok; by tele; if sed; if tele=. then delete; proc means; title "pridani generaci predku"; proc freq; tables pt; proc freq; taBLES PO; proc freq; tables pm; /*...................................prirazeni skupin.a koeficientu pro skupiny..*/ data prib; set druh; if o=. and m=. then koef=3; else if o=. then koef=2; else if m=. then koef=2; else koef=1; /*.. skupiny neznamych rodicu..*/ if o=. then o=2000000 + po; if m=. then m=2000000 + pm; keep tele o m koef; file pribuz; put tele o m koef; proc means;title "pridani koeficientu"; proc freq; tables koef;title "cetnosti podle koeficientu"; /*.......pocty ve skupinach neznamych rodicu...*/ data a; set prib; if o le 2000000 then delete; proc freq; tables o; title "pocty ve skupinach neznamych otcu"; data a; set prib; if m le 2000000 then delete; proc freq; tables m; title "pocty ve skupinach neznamych matek"; /*............................................konec..............................*/ run; /*..................PRECIS.....................................*/ /*................precislovava urovni efektu..................... */ /* navazuje na SESTROD */ /*.....................................1.11.2002.........................*/ /*..cte..*/ filename uzitk 'd:/pp/phmas93/uzitk'; filename prib 'd:/pp/phmas93/prib'; /*..zapisuje..*/ filename uz 'd:/pp/phmas93/uz'; filename matpri 'd:/pp/phmas93/matpri'; filename kodje 'd:/pp/phmas93/kodjed'; filename kodtp 'd:/pp/phmas93/kodtp '; filename kodpoh 'd:/pp/phmas93/kodpoh'; filename kodvrpp 'd:/pp/phmas93/kodvrpp'; filename kodvrna 'd:/pp/phmas93/kodvrna'; filename kodvr12 'd:/pp/phmas93/kodvr12'; filename kodvrod 'd:/pp/phmas93/kodvrod'; filename kodrok 'd:/pp/phmas93/kodrok'; filename kodvekm 'd:/pp/phmas93/kodvekm'; /*........................................................cteni.souboru puvodu.*/ data prib; infile prib; input tele o m koef; proc sort; by tele; proc means; title "vstupni rodokmen"; data a; set prib; keep jed; jed=tele; data b; set prib; keep jed; jed= o; data c; set prib; keep jed; jed=m; data kodje; set a b c; proc sort; by jed; data a; set kodje; by jed; if first.jed; if jed=. then delete; data a; set a; keep jed kod; kod=_n_; file kodje; put jed kod; data c; set a;tele=jed; proc means;title "jedinec, otec, matka spolecne"; data b; merge c prib(in=tel); by tele; if tel; tele=kod; keep tele o m koef; proc sort; by o; data c; set a; o=jed; proc sort; by o; data kodje; merge c b(in=otc); by o; if otc; o=kod; keep tele o m koef; proc sort; by m; data c; set a; m=jed; proc sort; by m; data b; merge c kodje(in=mat); by m; if mat; m=kod; keep tele o m koef; file matpri; put tele o m koef; proc means; title "precislovany rodokmen"; /*....................................................cteni.souboru uzitkovost.*/ data uzitk; infile uzitk; input tele tp plet plm pohl vrstpp vrstna vr12 vrod vrok het hep vekm obtp hnar h12 hod hro; mat=tp; jed=tele; drop plet plm; proc sort; by jed; proc means;title "vstup uzitkovosti do precislovani"; /*.......................................................................tele..*/ data tele; merge uzitk(in=ctel) a; by jed; if ctel; tele=kod; drop kod jed ; proc means; title "kody telat s uzitkovosti"; /*.................................................................... matky..*/ data mat; set tele; jed=mat; proc sort; by jed; data b; merge mat(in=matk) a; by jed; if matk; mat=kod; drop kod jed; proc means; title "kody matek s uzitkovosti"; /*.....................................................trvale prostredi matky.*/ data tp; set b; proc sort; by tp; data b; set tp; by tp; if first.tp; data b; set b; kod=_n_ ;keep tp kod; file kodtp; put tp kod; proc means;title "matky po vyhozeni opakujicich se jedincu"; data a; merge tp(in=trvp) b; by tp; if trvp; tp=kod; drop kod; proc means; title "uzitkovost po precislovani TP"; /*...................................................................pohlavi..*/ data poh; set a; proc sort; by pohl; data b; set poh; by pohl; if first.pohl; data b; set b; kod=_n_; keep pohl kod; file kodpoh; put pohl kod ; proc freq; tables pohl;title "cetnosti podle pohlavi"; proc means;title "prumery podle pohlavi"; data a; merge poh(in=pohla) b; by pohl; if pohla; pohl=kod; drop kod; proc means;title "uzitkovost po precislovani pohlavi"; /*.......................................................................vrst PP..*/ data vrpp; set a; vrpp = vrstpp; proc sort; by vrpp; data b; set vrpp; by vrpp; if first.vrpp; if vrpp=. then delete; data b; set b; kod=_n_; keep vrpp kod; file kodvrpp; put vrpp kod; proc means;title "skupiny vrstevniku pro prubeh porodu"; data a; merge vrpp(in=vrp) b; by vrpp; if vrp; vrpp=kod; drop kod; proc means;title "uzitkovost po precislovani vrstevniku"; /*.......................................................................vrstNA..*/ data vrna; set a; vrna = vrstna; drop vrst; proc sort; by vrna; data b; set vrna; by vrna; if first.vrna; if vrna=. then delete; data b; set b; kod=_n_; keep vrna kod; file kodvrna; put vrna kod; proc means;title "skupiny vrstevniku pro narozeni"; data a; merge vrna(in=vrn) b; by vrna; if vrn; vrna=kod; drop kod; proc means;title "uzitkovost po precislovani vrstevniku"; /*......................................................................vrs12.*/ data vr12; set a; proc sort; by vr12; data b; set vr12; by vr12; if first.vr12; if vr12=. then delete; data b; set b; kod=_n_; keep vr12 kod; file kodvr12; put vr12 kod; proc means;title "skupiny vrstevniku pro 120"; data a; merge vr12(in=v12) b; by vr12; if v12; vr12=kod; drop kod; proc means;title "uzitkovost po precislovani vrstevniku"; /*......................................................................vrodst..*/ data vrod; set a; proc sort; by vrod; data b; set vrod; by vrod; if first.vrod; if vrod=. then delete; data b; set b; kod=_n_; keep vrod kod; file kodvrod; put vrod kod; proc means;title "skupiny vrstevniku pro odstav"; data a; merge vrod(in=odst) b; by vrod; if odst; vrod=kod; drop kod; proc means;title "uzitkovost po precislovani vrstevniku"; /*.....................................................................vrstrok.*/ data rok; set a; proc sort; by vrok; data b; set rok; by vrok; if first.vrok; if vrok=. then delete; data b; set b; kod=_n_; keep vrok kod; file kodrok; put vrok kod; proc means;title "skupiny vrstevniku pro rok"; data a; merge rok(in=vahr) b; by vrok; if vahr; vrok=kod; drop kod; proc means;title "uzitkovost po precislovani vrstevniku"; /*.....................................................................vekmatky.*/ data vema; set a; proc sort; by vekm; data b; set vema; by vekm; if first.vekm; data b; set b; kod=_n_; keep vekm kod; file kodvekm; put vekm kod; proc freq; tables vekm;title "cetnosti podle veku matek"; proc means;title "prumery podle veku matek"; data a; merge vema(in=vek) b; by vekm; if vek; vekm=kod; drop kod; proc means;title "uzitkovost po precislovani vrstevniku"; /*..................................................................cely soubor.*/ data b; set a; proc means;title "cely precislovany soubor"; /*................................................... zmena meritka promennych..*/ data a; set b; obtp=obtp*200; hnar=hnar*10; h12=h12*2; hod= hod*1.5; proc means;title "zmena meritka obtp*200, hnar*10, h12*2, hod*1.5, hrok*1"; data b; set a; /*.. dosazeni 0 zachybejici tridy a uzitkovosti..*/ if vrpp=. then vrpp=0; if vrna=. then vrna=0; if vr12=. then vr12=0; if vrod=. then vrod=0; if vrok=. then vrok=0; if obtp=. then obtp=0; if hnar=. then hnar=0; if h12 =. then h12 =0; if hod =. then hod =0; if hro =. then hro =0; file uz; put tele mat tp pohl vrpp vrna vr12 vrod vrok het hep vekm obtp hnar h12 hod hro; proc means;title "dosazeni nul za chybejici udaje"; /*............................................konec..............................*/ run;