/*......... HODNOC .....................*/ /* spojene programy pro vyhodnoceni a prepis */ /* plemennych hodnot */ /* spojuje ctevys, rozvys, prevod, rezprom, phkor */ /* ........................ 17.9.2002 ........*/ /*..................CTEVYS..................*/ /*................vyhozeni prveho radku z vysledku ...... */ /* navazuje na BLUP */ /*.....................................17.9.2003.........................*/ dm output 'clear'; dm log 'clear'; options firstobs=2; filename res 'd:/pp/phmas93/solma'; /*..cte..*/ filename sn 'd:/pp/phmas93/solblu'; /*..pise..*/ /*......................................................................nar..*/ data resen ; infile res missover ; input vlast efekt uroven hodno; file sn; put vlast efekt uroven hodno; /*..........................*/ run; /*..................ROZVYs.........................*/ /*................rezebrani vysledku ....... */ /* navazuje na CTEVYS podle efektu */ /*.....................................17.9.2003.........................*/ options firstobs=1; /*...cte......*/ 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'; filename solb 'd:/pp/phmas93/solblu'; /*....pise....*/ filename phjed 'd:/pp/phmas93/phjed'; /*........................................sloupec reseni.............................*/ data solnar; infile solb; input vlast efekt kod hodno; data spp; set solnar; if vlast=1; pp=hodno;drop hodno; data sna; set solnar; if vlast=2; nar=hodno;drop hodno; data s12; set solnar; if vlast=3; h12=hodno;drop hodno; data s21; set solnar; if vlast=4; h21=hodno;drop hodno; data sro; set solnar; if vlast=5; hro=hodno;drop hodno; data sn; merge spp sna s12 s21 sro; proc means;title "udaje sloupce reseni"; data sol; set sn; pp=pp/200; nar=nar/10; h12=h12/2; h21=h21/1.5; drop vlast; proc means;title "sloupce reseni - prodeleno na puvodni meritko"; /*.....................................................................pohlavi..*/ data pohlavi; set sol; if efekt ne 1 then delete; data a; set pohlavi; proc means; title "pohlavi"; data poh; infile kodpoh; input pohl kod ; proc means; /*..pripojeni cisla..*/ data pohlavi; merge poh a; by kod; proc means; proc print; /*.....................................................................vekmatky..*/ data vekmatky; set sol; if efekt ne 2 then delete; data a; set vekmatky; proc means; title "vek matky"; data poh; infile kodvekm; input vekm kod ; proc means; /*..pripojeni cisla..*/ data vekmatky; merge poh a; by kod; proc means; proc print; /*..............................................................heteroze telat..*/ data hetel; set sol; if efekt ne 3 then delete; data a; set hetel; proc means; title "heteroze telata"; data hetel; set a; by kod; hetel= kod; proc means; proc print; /*..............................................................heteroze matek..*/ data hetmat; set sol; if efekt ne 4 then delete; data a; set hetmat; proc means; title "heteroze matky"; data hetmat; set a; by kod; hetmat= kod; proc means; proc print; /*.................................................................primy efekt..*/ data primef; set sol; if efekt ne 6 then delete; data a; set primef; proc means; title "primy efekt"; data poh; infile kodje; input jedin kod ; proc means; /*..pripojeni cisla..*/ data primef; merge poh a; by kod; keep jedin kod phpp phnar ph12 ph21 ph36; phpp=pp; phnar=nar; ph12=h12; ph21=h21; ph36=hro; proc means; /*.............................................................maternalni efekt.*/ data matef; set sol; if efekt ne 7 then delete; data a; set matef; proc means; title "maternalni efekt"; data poh; infile kodje; input jedin kod ; proc means; /*..pripojeni cisla..*/ data matef; merge poh a; by kod; keep jedin kod mapp manar ma12 ma21 ma36; mapp=pp; manar=nar; ma12=h12; ma21=h21; ma36=hro; proc means; /*......................................................trvale prostredi matky..*/ data trpro; set sol; if efekt ne 8 then delete; data a; set trpro; proc means; title "trvale prostredi matek"; data poh; infile kodtp; input jedin kod ; proc means; /*..pripojeni cisla..*/ data trpro; merge poh a; by kod; keep jedin tppp tpnar tp12 tp21 tpro; tppp=pp; tpnar=nar; tp12=h12; tp21=h21; tpro=hro; proc sort; by jedin; proc means; /*...........................................................vysledky jedince....*/ data a; merge primef matef; by kod; proc sort; by jedin; proc means; title "Plemenne hodnoty"; data phjed; merge a trpro; by jedin; drop kod ; proc means; /*.....................................................................plemeno..*/ data plem; set phjed; if 2000001 > jedin then delete; plem=jedin - 2000000 ; aa = 1 ; drop jedin tppp tpnar tp12 tp21 tpro ; proc means; title "plemena"; proc means noprint; output out=pru mean=; data a; set pru; keep pphpp pphnar pph12 pph21 pph36 pmapp pmanar pma12 pma21 pma36 aa ; aa=1; pphpp=phpp; pphnar=phnar; pph12=ph12; pph21=ph21; pph36=ph36; pmapp=mapp; pmanar=manar; pma12=ma12; pma21=ma21; pma36=ma36; proc means; data poh; merge a plem; by aa ; keep phpp phnar ph12 ph21 ph36 mapp manar ma12 ma21 ma36 plem aa; phpp=phpp-pphpp; phnar=phnar-pphnar; ph12=ph12-pph12; ph21=ph21-pph21; ph36=ph36-pph36; mapp=mapp-pmapp; manar=manar-pmanar; ma12=ma12-pma12; ma21=ma21-pma21; ma36=ma36-pma36; proc means; proc print; /*................................................................plemenna hodnota..*/ data plem; set phjed; if jedin > 2000000 then delete; aa = 1 ; proc means; title "plemenne hodnoty"; proc means noprint; output out=pru mean=; data a; set pru; keep pphpp pphnar pph12 pph21 pph36 pmapp pmanar pma12 pma21 pma36 ptppp ptpnar ptp12 ptp21 ptpro aa ; aa=1; pphpp=phpp; pphnar=phnar; pph12=ph12; pph21=ph21; pph36=ph36; pmapp=mapp; pmanar=manar; pma12=ma12; pma21=ma21; pma36=ma36; ptppp=tppp; ptpnar=tpnar; ptp12=tp12; ptp21=tp21; ptpro=tpro; proc means; data poh; merge a plem; by aa ; keep phpp phnar ph12 ph21 ph36 mapp manar ma12 ma21 ma36 tppp tpnar tp12 tp21 tpro; phpp=phpp-pphpp; phnar=phnar-pphnar; ph12=ph12-pph12; ph21=ph21-pph21; ph36=ph36-pph36; mapp=mapp-pmapp; manar=manar-pmanar; ma12=ma12-pma12; ma21=ma21-pma21; ma36=ma36-pma36; tppp=tppp-ptppp; tpnar=tpnar-ptpnar; tp12=tp12-ptp12; tp21=tp21-ptp21; tpro=tpro-ptpro; file phjed; put jedin phpp phnar ph12 ph21 ph36 mapp manar ma12 ma21 ma36 tppp tpnar tp12 tp21 tpro; proc means; /*............................................konec..............................*/ run; /*..................prevod................................................*/ /* vysledky uklada po castech ve formatu */ /*. navazuje na ROZVYS */ /*.....................................17.9.2003........................*/ filename phjed 'd:/pp/phmas93/phjed'; /*..cte..*/ filename phn 'd:/pp/phmas93/phnar'; /*..pise..*/ filename phr 'd:/pp/phmas93/phrus'; filename man 'd:/pp/phmas93/manar'; filename mar 'd:/pp/phmas93/marus'; filename tp 'd:/pp/phmas93/tp'; /*.................................................vysledky nacteni............*/ data phjed; infile phjed; input jedin phobt phnar ph120 ph210 phrok maobt manar ma120 ma210 marok tpobt tpnar tp120 tp210 tprok ; proc means; title "nactene vysledky plemennych hodnot"; data ph; set phjed; keep jedin phobt phnar ; if phobt=. and phnar=. then delete; file phn; put jedin 1-8 phobt 11-18 3 phnar 21-28 3 ; proc means; title "plemenne hodnoty primy efekt pp + nar"; data ph; set phjed; keep jedin ph120 ph210 phrok; if ph120=. and ph210=. and phrok=. then delete; file phr; put jedin 1-8 ph120 11-18 3 ph210 21-28 3 phrok 31-38 3 ; proc means; title "plemenne hodnoty primy efekt 120 + 210 + rok"; data ma; set phjed; keep jedin maobt manar ; if maobt=. and manar=. then delete; file man; put jedin 1-8 maobt 11-18 3 manar 21-28 3 ; proc means;title " maternalni efekt pp + nar"; data ma; set phjed; keep jedin ma120 ma210 marok; if ma120=. and ma210=. and marok=. then delete; file mar; put jedin 1-8 ma120 11-18 3 ma210 21-28 3 marok 31-38 3 ; proc means;title " maternalni efekt 120 + 210 + rok"; data tp; set phjed; keep jedin tpobt tpnar tp120 tp210 tprok; if tpobt=. and tpnar=. and tp120=. and tp210=. and tprok=. then delete; file tp; put jedin 1-8 tpobt 11-18 3 tpnar 21-28 3 tp120 31-38 3 tp210 41-48 3 tprok 51-58 3; proc means; title "trvale prostredi"; /*............................................konec..............................*/ run; /*............... rezprom .......................................*/ /*vypocet rezidualni smerodatne odchylky a rezidualni korelace po odecteni*/ /* vysledku AM ..........*/ /*.......................17.91.2002. VUZV Uhrineves Josef Pribyl */ options firstobs=1 obs=max; /*...cte......*/ filename uz 'd:/pp/phmas93/uz'; filename solb 'd:/pp/phmas93/solblu'; /*............nacteni uzitkovosti..............................................*/ data da; infile uz; input tele mat tp pohl vrpp vrna vr12 vrod vrok het hep vekm obtp hnar h12 hod hro; if vrpp = 0 then vrpp = . ; if vrna = 0 then vrna = . ; if vr12 = 0 then vr12 = . ; if vrod = 0 then vrod = . ; if vrok = 0 then vrok = . ; if obtp = 0 then obtp = . ; if hnar = 0 then hnar = . ; if h12 = 0 then h12 = . ; if hod = 0 then hod = . ; if hro = 0 then hro = . ; obtp=obtp/200; hnar=hnar/10; h12=h12/2; hod=hod/1.5; proc means;title "nactena uzitkovost"; /*......................rozlozeni vektoru reseni.............................*/ data solnar; infile solb; input vlast efekt kod hodno; data spp; set solnar; if vlast=1; pob=hodno; drop hodno; data sna; set solnar; if vlast=2; pnar=hodno;drop hodno; data s12; set solnar; if vlast=3; ph12=hodno;drop hodno; data s21; set solnar; if vlast=4; ph21=hodno;drop hodno; data sro; set solnar; if vlast=5; phro=hodno;drop hodno; data sn; merge spp sna s12 s21 sro; proc means;title "udaje sloupce reseni"; data sol; set sn; pob=pob/200; pnar=pnar/10; ph12=ph12/2; ph21=ph21/1.5; drop vlast; proc means;title "sloupce reseni - prodeleno na puvodni meritko"; /*.................................rozdeleni podle efektu........*/ /*.....................................................................pohlavi..*/ data poh; set sol; if efekt ne 1 then delete; data a; set poh; proc means; title "pohlavi"; data poh; set a; pohl= kod; drop kod; proc sort; by pohl; /*.........................dosazeni do souboru uzitkovosti.....................*/ data prac; set da; proc sort; by pohl; data da; merge prac(in=po) poh; by pohl; if po ; obtp = obtp - pob; hnar = hnar - pnar; h12 = h12 - ph12; hod = hod - ph21; hro = hro - phro; drop pob pnar ph12 ph21 phro; proc means; title "od uzitkovosti odecteno pohlavi"; /*.....................................................................vek matky..*/ data poh; set sol; if efekt ne 2 then delete; data a; set poh; proc means; title "vek matky"; data poh; set a; vekm= kod; drop kod; proc sort; by vekm; /*.........................dosazeni do souboru uzitkovosti.....................*/ data prac; set da; proc sort; by vekm; data da; merge prac(in=ve) poh; by vekm; if ve ; obtp = obtp - pob; hnar = hnar - pnar; h12 = h12 - ph12; hod = hod - ph21; hro = hro - phro; drop pob pnar ph12 ph21 phro; proc means; title "od uzitkovosti odecten vek matky"; /*....................................................................heteroze telat..*/ data poh; set sol; if efekt ne 3 then delete; data a; set poh; proc means; title "heteroze telat"; data poh; set a; a = 1 ; drop kod; /*.........................dosazeni do souboru uzitkovosti.....................*/ data prac; set da; a = 1; data da; merge prac(in=ht) poh; by a; if ht; obtp = obtp - het*pob; hnar = hnar - het*pnar; h12 = h12 - het*ph12; hod = hod - het*ph21; hro = hro - het*phro; drop pob pnar ph12 ph21 phro a ; proc means; title "od uzitkovosti odectena heteroze telat"; /*....................................................................heteroze matek..*/ data poh; set sol; if efekt ne 4 then delete; data a; set poh; proc means; title "heteroze matek"; data poh; set a; a = 1 ;drop kod; /*.........................dosazeni do souboru uzitkovosti.....................*/ data prac; set da; a = 1 ; data da; merge prac(in=hm) poh; by a ; if hm; obtp = obtp - hep*pob; hnar = hnar - hep*pnar; h12 = h12 - hep*ph12; hod = hod - hep*ph21; hro = hro - hep*phro; drop pob pnar ph12 ph21 phro a ; proc means; title "od uzitkovosti odectena heteroze matek"; /*.....................................................................SRO pp..*/ data poh; set sol; if efekt ne 5 then delete; if pob = 0 then pob = . ; if pnar= 0 then pnar = . ; if ph12= 0 then ph12= . ; if ph21= 0 then ph21= . ; if phro= 0 then phro= . ; data a; set poh; proc means; title "SRO porody"; data poh; set a; vrpp= kod; drop kod; proc sort; by vrpp; /*.........................dosazeni do souboru uzitkovosti.....................*/ data prac; set da; proc sort; by vrpp; data da; merge prac(in=vrp) poh; by vrpp; if vrp; /*.........??? in=vrp...pocty pripadu..*/ obtp = obtp - pob; drop pob pnar ph12 ph21 phro; proc means; title "od uzitkovosti odecteno SRO porody"; /*.....................................................................SRO nar..*/ data poh; set poh; vrna= vrpp; drop vrpp; proc sort; by vrna; /*.........................dosazeni do souboru uzitkovosti.....................*/ data prac; set da; proc sort; by vrna; data da; merge prac(in=vrn) poh; by vrna; if vrn; hnar = hnar - pnar; drop pob pnar ph12 ph21 phro; proc means; title "od uzitkovosti odecteno SRO vaha narozeni"; /*.....................................................................SRO 120..*/ data poh; set poh; vr12= vrna; drop vrna; proc sort; by vr12; /*.........................dosazeni do souboru uzitkovosti.....................*/ data prac; set da; proc sort; by vr12; data da; merge prac(in=vr1) poh; by vr12; if vr1; h12 = h12 - ph12; drop pob pnar ph12 ph21 phro; proc means; title "od uzitkovosti odecteno SRO vaha 120"; /*.....................................................................SRO 210..*/ data poh; set poh; vrod= vr12; drop vr12; proc sort; by vrod; /*.........................dosazeni do souboru uzitkovosti.....................*/ data prac; set da; proc sort; by vrod; data da; merge prac(in=vrd) poh; by vrod; if vrd; hod = hod - ph21; drop pob pnar ph12 ph21 phro; proc means; title "od uzitkovosti odecteno SRO vaha 210"; /*.....................................................................SRO rok..*/ data poh; set poh; vrok= vrod; drop vrod; proc sort; by vrok; /*.........................dosazeni do souboru uzitkovosti.....................*/ data prac; set da; proc sort; by vrok; data da; merge prac(in=vrk) poh; by vrok; if vrk; hro = hro - phro; drop pob pnar ph12 ph21 phro; proc means; title "od uzitkovosti odecteno SRO vaha 365"; /*.....................................................................primy efekt..*/ data poh; set sol; if efekt ne 6 then delete; data a; set poh; proc means; title "primy efekt"; data poh; set a; tele= kod; drop kod; proc sort; by tele; /*.........................dosazeni do souboru uzitkovosti.....................*/ data prac; set da; proc sort; by tele; data da; merge prac(in=tel) poh; by tele; if tel; obtp = obtp - pob; hnar = hnar - pnar; h12 = h12 - ph12; hod = hod - ph21; hro = hro - phro; drop pob pnar ph12 ph21 phro; proc means; title "od uzitkovosti odecten primy efekt"; /*.....................................................................maternalni efekt..*/ data poh; set sol; if efekt ne 7 then delete; data a; set poh; proc means; title "maternalni efekt"; data poh; set a; mat= kod; drop kod; proc sort; by mat; /*.........................dosazeni do souboru uzitkovosti.....................*/ data prac; set da; proc sort; by mat; data da; merge prac(in=ma) poh; by mat; if ma; obtp = obtp - pob; hnar = hnar - pnar; h12 = h12 - ph12; hod = hod - ph21; hro = hro - phro; drop pob pnar ph12 ph21 phro; proc means; title "od uzitkovosti odecten maternalni efekt"; /*.....................................................................trvale materske prostredi..*/ data poh; set sol; if efekt ne 8 then delete; data a; set poh; proc means; title "trvale materske prostredi"; data poh; set a; tp= kod; drop kod; proc sort; by tp; /*.........................dosazeni do souboru uzitkovosti.....................*/ data prac; set da; proc sort; by tp; data da; merge prac(in=tpr) poh; by tp; if tpr; obtp = obtp - pob; hnar = hnar - pnar; h12 = h12 - ph12; hod = hod - ph21; hro = hro - phro; drop pob pnar ph12 ph21 phro; proc means; title "od uzitkovosti odecteno trvale materske prostredi"; proc corr; var obtp hnar h12 hod hro ; title "korelace rezidui z AM"; run; /*.................................*/ /*..................PHKOR.........................*/ /*................korelace mezi vysledky PH vlastnosti...... */ /* navazuje na ROZVYS */ /*.....................................8.11.2002.........................*/ options firstobs=1; /*......cte.....*/ filename phjed 'd:/pp/phmas93/phjed'; filename rodok 'd:/pp/phmas93/rodok/'; /*....????rodok....*/ filename uzitk 'd:/pp/phmas93/uzitk'; /*...................................Celkova PH s prictenim efektu G. skupiny.........*/ data ph; infile phjed; input jedin phpp phnar ph12 ph21 ph36 mapp manar ma12 ma21 ma36 tppp tpnar tp12 tp21 tpro; proc sort; by jedin; proc means; title "plemenne hodnoty"; /*................................korelace.celkove PH.............................*/ proc corr; var phpp phnar ph12 ph21 ph36; title "korelace plemennych hodnot"; proc corr; var mapp manar ma12 ma21 ma36; title "korelace maternalni efekty"; proc corr;var phpp phnar ph12 ph21 ph36; with mapp manar ma12 ma21 ma36; title "korelace primy efekt s maternalnim"; proc corr; var tppp tpnar tp12 tp21 tpro; title "korelace trvaleho prostredi"; proc corr;var phpp phnar ph12 ph21 ph36; with tppp tpnar tp12 tp21 tpro; title "korelace primy efekt s trvalym prostredim"; proc corr;var mapp manar ma12 ma21 ma36; with tppp tpnar tp12 tp21 tpro; title "korelace maternalni efekt s trvalym prostredim"; /*................................korelace.uvnitr plemen............................*/ /*........................................................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=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=11 then po=9; else if po=. and pt=12 then po=9; else if po=. and pt=37 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=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=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; 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= 5; else if pt=. and po=13 and pm=4 then pt=5; else if pt=. and po=13 and pm=3 then pt=4; 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=31 then pt=32; else if pt=. and po=33 and pm=32 then pt=33; else if pt=. and po=33 then pt=31; 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=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=35; else if pt=. and po=29 and pm=29 then pt=29; 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=27; 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=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; 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=5; else if pm=. and po=5 and pt=3 then pm=5; else if pm=. and po=5 and pt=4 then pm=5; 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 pm= 5; else if pm=. and po=13 and pt=4 then pm=4; else if pm=. and po=13 and pt=3 then pm=5; 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=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=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=35 then pm=5; 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=27 then pm=5; 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=39 then pm=5; 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=5; else if pm=. and po=50 and pt=48 then pm=48; else if pm=. and po=50 and pt=49 then pm=50; else if pm=. and po=50 then pm=5; else if pm=. then pm= 5; proc means; /*.................................................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; %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 vrst 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"; data a; set druh; jedin=tele; keep jedin pt; proc sort; by jedin; data b; set a; if pt = 1 then ple = 1 ; else if pt = 14 or pt = 15 then ple = 2; else if pt = 16 then ple = 3; else if pt = 2 or pt = 3 or pt = 4 then ple = 4; else if pt = 5 then ple = 5; else if pt = 17 or pt = 18 then ple = 6; else if pt = 19 then ple = 7; else if pt = 30 or pt = 31 or pt = 32 then ple = 8; else if pt = 33 then ple = 9; else if pt = 23 or pt = 24 then ple = 10; else if pt = 25 then ple = 11; else if pt = 45 or pt = 46 then ple = 12; else if pt = 47 then ple = 13; else if pt = 42 or pt = 43 then ple = 14; else if pt = 44 then ple = 15; else if pt = 6 or pt = 7 or pt = 8 or pt = 9 or pt = 10 then ple = 16; else if pt = 11 or pt = 12 then ple = 17; else if pt = 13 then ple = 18; else if pt = 34 or pt = 35 or pt = 36 then ple = 19; else if pt = 37 then ple = 20; else if pt = 26 or pt = 27 or pt = 28 then ple = 21; else if pt = 29 then ple = 22; else if pt = 20 or pt = 21 then ple = 23; else if pt = 22 then ple = 24; else if pt = 38 or pt = 39 or pt = 40 then ple = 25; else if pt = 41 then ple = 26; else if pt = 48 or pt = 49 then ple = 27; else if pt = 50 then ple = 28; else delete; drop pt; proc means; title "seskupeny plemenne skupiny"; data a; merge ph b; by jedin; proc sort; by ple; proc means; title "plemenne hodnoty soubor cerlkem, pridany skupiny"; proc means; by ple; title "plemenne hodnoty podle plemenných skupin"; /*........................................................................................*/ proc glm; title "rozdily plemennych hodnot mezi skupinami"; class ple; model phpp phnar ph12 ph21 ph36 mapp manar ma12 ma21 ma36 tppp tpnar tp12 tp21 tpro = ple; lsmeans ple / pdiff stderr tdiff ; /*manova / printe;*/title "korelace mezi plemennymi hodnotami uvnitr plemenných skupin"; run;