/*..................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.........................*/ dm output 'clear'; dm log 'clear'; /*..cte..*/ filename rod 'c:/uzivatele/phmas92/rod'; filename obt 'c:/uzivatele/phmas92/obt'; filename nar 'c:/uzivatele/phmas92/nar'; filename v12 'c:/uzivatele/phmas92/v12'; filename vod 'c:/uzivatele/phmas92/vod'; filename vro 'c:/uzivatele/phmas92/vro'; /*..zapisuje..*/ filename rodok 'c:/uzivatele/phmas92/rodok'; filename uzitk 'c:/uzivatele/phmas92/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; if vrst=. then vrst=vrst1; if vekm=. or vekm=2 and vekm1 ne . then vekm=vekm1; keep tele mat otc plet plm pohl vrst 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 vrst 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 vrst 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 vrst 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 vrst vr12 vrod vrok het hep vekm obtp hnar h12 hod hro; file uzitk; put tele tp plet plm pohl vrst 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;