*GENERAL NOTE THIS PROGRAM IS CURRENTLY SET UP FOR AUTOTETRAPLOIDS WITH 16 POTENTIAL FATHERS AND 19 SSR SCORED ON INDIVIDUALS; *SSR NUMBER; *CURRENTLY THE PROGRAM IS SET UP TO ACCOMIDATE UP TO 99 SSR PER INDIVIDUAL; %MACRO SSR; 17 %MEND SSR; *NUMBER OF FATHERS; %MACRO FAT; 26 %MEND FAT; *DATA SET A IS THE PROGENY DATA, MARKERS HAVE TO BE LABELED M + ALLELE + SSR IN SEQUENTIAL ORDER FOR SAS MACROS TO PROCESS; *FOR EACH PROGENY EACH SSR LOCUS CAN HAVE ONLY ONE ALLELE LISTED (I.E. EVEN IF DOSAGE IS KNOWN IT SHOULD NOT BE LISTED FOR THE PROGRAM TO FUNCITON CORRECTLY; DATA A; LENGTH ID $ 16; INPUT ROW PLANT FEMALE ID $ M11 M21 M31 M41 M51 M61 M12 M22 M32 M42 M52 M62 M13 M23 M33 M43 M53 M63 M14 M24 M34 M44 M54 M64 M15 M25 M35 M45 M55 M65 M16 M26 M36 M46 M56 M66 M17 M27 M37 M47 M57 M67 M18 M28 M38 M48 M58 M68 M19 M29 M39 M49 M59 M69 M110 M210 M310 M410 M510 M610 M111 M211 M311 M411 M511 M611 M112 M212 M312 M412 M512 M612 M113 M213 M313 M413 M513 M613 M114 M214 M314 M414 M514 M614 M115 M215 M315 M415 M515 M615 M116 M216 M316 M416 M516 M616 M117 M217 M317 M417 M517 M617; CARDS; 1 1 18 K003-A01 106 . . . . . 138 141 150 . . . 177 179 197 . . . 248 258 263 . . . 293 298 301 . . . 352 354 . . . . 376 . . . . . 159 161 164 . . . 221 . . . . . 260 266 271 288 . . 105 109 112 . . . 140 143 146 149 . . 193 196 199 . . . 227 237 239 242 247 . 124 136 . . . . 287 290 295 298 . . 324 330 333 . . . 1 1 18 K004-A01 106 . . . . . 138 141 150 152 . . 177 179 183 197 . . 248 258 263 . . . 293 296 298 301 . . 352 354 . . . . 376 . . . . . 158 159 . . . . 221 230 . . . . 255 260 266 271 288 . 105 109 112 . . . 140 143 146 149 . . 193 196 199 206 . . 227 237 241 243 247 . 124 136 . . . . 290 . . . . . 324 330 333 . . . 1 1 1 1 1 1 1 1 152 . . 164 271 146 247 295 1 147 263 354 161 271 146 241 . 1 147 263 . 161 271 149 241 295 1 . . . . . . . . 2 144 263 . 161 271 146 243 284 2 147 263 . 174 266 149 241 287 2 . . 18 . . . 174 288 149 . 298 18 . . . . 288 149 . . 18 150 . . 164 288 154 . . 18 . . . . . . . . 19 152 . . 164 288 149 . 287 19 152 . . . 271 . 243 290 19 . . K005-C08 . . . . . . . . . . . . . . . . K008-E03 . . . . . . . . . . 154 . . . . . K010-E03 152 . . . . . 174 . . . . . . . . . K012-H03 . . . . . . . . . . . . . . . . K003-B01 . . . . . . 174 . . . . . . . 290 292 K004-B01 . . . . . . . . 288 . . . 250 . 295 307 K005-D08 . . . . 106 177 293 376 221 105 193 124 . 99 177 293 376 221 105 193 124 330 99 177 293 376 221 105 193 124 324 . . . . . . . . . 99 177 293 376 221 105 187 124 330 106 177 293 376 221 105 187 124 327 . . . . 179 296 379 230 109 196 . . 106 179 296 379 230 109 196 136 333 112 179 296 379 . 109 196 127 330 . . . . . . . . . . 179 296 382 227 112 193 133 333 112 179 296 . . 112 193 136 330 . . . . 183 298 382 . 112 199 . . 112 182 298 381 . 112 . . . . 183 298 382 . 112 199 136 333 . . . . . . . . . . 183 298 . 230 . 199 136 . . 197 298 . . 115 199 . 333 . . . . 197 301 . . . . . . . 183 298 . . . . . . . 194 301 . . . . . . . . . . . . . . . . 197 301 . . . 206 . . . . 301 . . . 206 . 336 . . . . . . . . . . . . . 194 328 . . . . . . . . . . . . . . . . . . . . . . . . . 208 . . . . . . . . . 328 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 248 352 159 260 140 237 284 150 258 354 161 266 143 241 290 138 248 349 158 260 140 227 281 141 258 352 159 266 143 237 290 138 248 352 158 260 140 227 284 141 258 354 159 266 143 237 290 . . . . . . . . . . . . . . . . 138 248 352 158 260 140 237 278 141 258 354 159 266 143 241 281 138 248 352 158 255 143 237 278 141 258 354 161 260 146 239 284 . . . . . . 1 . . . . . . 2 150 263 . 161 266 . 241 290 . . . . . . 19 . . . 174 271 . 243 . . . . . . . . . . . . . K008-F03 . . . . . . . . 288 . . . . . . . . . . . . . 112 177 293 376 221 105 193 124 324 . . . . . . . 179 296 . 230 112 196 136 330 . . . . . . . 183 298 . . . 199 . 333 . . . . . . . 194 301 . . . . . . . . . . . . . 197 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 248 352 158 255 143 227 278 141 258 354 159 260 149 237 281 ; *ETC.; *DATA SET B UPDATES PROGENY SET TO ADD F TO CREATE A SEQUENTIAL NUMBER VARIABLE F FOR FEMALES FOR SAS MACRO PROCESSING; DATA BX; SET A; F = FEMALE; RUN; PROC PRINT; RUN; DATA B; SET BX; RUN; *DATA SET C CONTAINS PARENTAL GENOTYPES, MARKERS NEED + SSR IN SEQUENTIAL ORDER FOR SAS MACROS TO PROCESS; DATA C1; INPUT FEMALE P11 P21 P31 P41 P51 P61 P12 P22 P32 P42 P52 P62 P13 P23 P33 P43 P53 P63 P14 P24 P34 P44 P54 P64 P15 P25 P35 P45 P55 P65 P16 P26 P36 P46 P56 P66 P17 P27 P37 P47 P57 P67 P18 P28 P38 P48 P58 P68 P19 P29 P39 P49 P59 P69 P110 P210 P310 P410 P510 P610 P111 P211 P311 P411 P511 P611 P112 P212 P312 P412 P512 P612 P113 P213 P313 P413 P513 P613 P114 P214 P314 P414 P514 P614 P115 P215 P315 P415 P515 P615 P116 P216 P316 P416 P516 P616 P117 P217 P317 P417 P517 P617; CARDS; 1 99 106 112 . . . 138 141 177 179 181 183 . . 248 255 298 301 328 . . . 352 354 376 379 382 . . . 156 161 TO BE LABLED P + ALLELE 152 258 . 164 . . . 175 . . . . . . . . 2 3 4 5 6 7 221 105 193 124 324 90 177 298 376 221 105 193 124 327 90 177 293 376 221 105 193 127 327 90 177 293 376 221 105 187 124 327 99 177 301 376 221 105 193 124 330 112 169 293 376 221 105 193 124 330 112 179 301 376 221 105 193 230 112 196 130 327 99 179 301 379 224 112 . 133 330 99 179 298 379 224 112 . 130 333 99 179 298 381 230 112 193 130 330 112 179 328 379 230 112 206 127 333 . 177 298 . 224 112 199 127 333 . 182 307 379 230 112 199 . . 199 . 330 112 182 328 386 230 . . 136 333 112 . 301 382 227 . . 133 . 106 182 301 386 . . 199 133 333 . 183 . 381 . . . . . . 179 301 . 230 . . 130 . . 194 . 382 . . . . . . . 333 . 183 . . . . . . 336 . . 328 . 230 . . 136 . 112 194 328 . . . . . . . . . 386 . . . . . . 183 328 . . . . . . . . . . . . . . . . . . . 194 . . . . . . . . . . . . . . . . . 197 . . . . . . . . . . . . . . . . . 197 . . . . . . . . . . . . . . . . . . . . 197 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 140 237 278 266 143 243 287 271 146 . 290 277 149 . . . . . . . . . . 138 248 352 156 260 143 237 284 141 258 354 159 266 146 241 290 147 263 . 161 271 149 247 295 150 . . 175 277 151 . 298 . . . . 288 154 . . . . . . . . . . 138 248 352 153 260 140 227 278 141 258 354 156 266 143 241 284 . . . 159 271 146 243 290 . . . 161 277 149 . 295 . . . 174 . 151 . . . . . . . . . . 138 248 349 156 255 140 239 278 147 258 352 159 266 143 241 284 150 . 354 161 271 146 242 287 . . . . 288 . 243 295 . . . . . . 247 298 . . . . . . . . 138 248 349 156 260 143 227 278 141 258 354 161 266 146 237 290 147 263 . 175 277 149 243 292 152 . . . . 154 . 295 . . . . . . . . . . . . . . . . 138 248 349 156 260 143 227 284 152 258 352 159 266 146 237 290 . 263 354 161 271 149 241 304 . . . 175 . 154 252 . . . . . . . . . . . . . . . . . 138 248 352 156 260 143 227 141 258 354 159 266 149 237 150 263 . 161 271 151 243 152 . . 175 . . . . . . . . . . . . . . . . . 8 10 11 12 13 14 124 327 99 177 298 376 221 105 193 124 327 99 177 296 376 221 105 187 124 330 112 177 296 376 221 105 187 124 327 99 177 298 376 221 105 187 124 327 99 177 293 376 221 105 187 124 325 99 177 293 376 221 105 187 124 330 136 330 112 179 301 382 224 112 . 130 333 112 179 301 . 227 109 193 127 333 . 179 298 379 . 112 193 127 330 106 182 301 . 224 109 193 130 333 112 179 298 382 224 109 193 130 327 112 179 301 386 230 112 193 127 333 . 333 . 181 307 . . 115 . . . . 181 . . . 112 199 130 . . . 301 381 . . 196 . . 112 194 307 . . 115 . 136 336 . . 301 . . 112 . 133 330 . 183 304 . . . 196 130 336 . . . 197 . . . . . . . . 197 . . . . . . . . . 304 386 . . 199 . . . . 328 . . . . . . . . 304 . . 115 . 136 333 . . 307 . . . 199 . . . . . . . . . . . . . . . . . . . . . . . . 307 . . . . . . . . . . . . . . . . . 328 . . . . . . . . 328 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 290 295 307 . . 138 248 352 159 260 143 237 284 144 258 354 161 266 146 241 287 147 263 . 175 271 . 242 290 . . . . 288 . . 295 . . . . . . . 307 . . . . . . . . 138 248 352 158 255 143 237 278 141 258 354 161 260 146 239 284 144 263 . . 266 149 241 287 147 . . . 271 . 243 290 . . . . 288 . . . . . . . . . . . 138 248 349 156 260 143 227 278 141 258 352 158 266 146 237 284 147 263 354 159 . 149 243 287 152 . . 161 . . . 290 . . . . . . . 307 . . . . . . . . 138 248 354 158 255 143 227 281 147 258 . 159 260 146 237 284 150 263 . 161 266 149 241 290 157 . . . 271 . 250 295 . . . . . . . 298 . . . . . . . 307 138 248 349 159 260 143 237 284 141 258 354 161 266 146 241 290 147 263 . 174 271 149 . 295 150 . . . . . . 307 . . . . . . . . . . . . . . . . 138 248 349 153 255 143 227 284 141 258 352 156 260 146 237 290 147 263 354 161 271 149 241 292 152 . . 174 277 154 252 295 . . . 175 . . . . . . . . . . . . 15 16 17 18 19 20 21 99 177 293 376 221 105 193 124 330 99 177 296 376 221 105 187 124 333 99 169 293 376 221 105 193 124 327 106 179 293 376 221 105 193 124 324 99 177 293 376 221 105 187 124 330 90 177 296 376 221 105 187 124 327 106 177 296 106 179 296 381 230 109 196 127 333 106 179 298 382 227 . 193 133 . 112 177 301 386 224 112 . 127 333 . 182 296 379 230 109 196 136 330 112 179 296 . 230 112 193 136 333 112 179 298 . 230 112 193 127 330 . 179 301 112 197 298 382 . 112 199 136 . 119 182 301 . . . 196 . . . 179 304 . 230 . . 130 . . 183 298 . . 112 199 . 333 . 183 298 . . . 199 . . . . 301 . . . 206 130 333 . . 307 . . 301 . . . . . . . 194 328 . . . . . . . 182 316 . . . . . . . 194 301 . . . . . . . 197 301 . . . 206 . . . . 304 . . . . . 336 . . . . . 328 . . . . . . . 197 . . . . . . . . 194 328 . . . . . . . 197 . . . . . . . . . . . . . . . . . . 307 . . . . . . . . . . . . . . . . . . . 208 . . . . . . . . 197 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 248 349 158 260 143 227 281 144 258 352 159 266 146 237 284 147 263 354 161 288 149 241 290 150 . . 174 . 154 . . 152 . . 175 . . . . . . . . . . . . 138 248 352 156 255 140 237 281 144 258 354 159 260 146 241 284 150 263 . 161 266 149 . 287 152 . . 164 271 151 . 290 . . . . . . . 295 . . . . . . . . 138 248 352 156 260 143 227 278 141 258 354 159 271 146 237 290 144 . . 161 277 149 243 295 152 . . 175 . . 247 298 . . . . . . . 304 . . . . . . . . 138 248 352 159 260 140 227 287 141 258 354 161 266 143 237 290 150 263 . 164 271 149 241 295 . . . . 288 . 242 298 . . . . . . 247 . . . . . . . . . 138 248 352 158 255 143 237 278 141 258 354 161 260 146 239 281 147 263 . 174 266 149 241 287 152 . . . 271 . 243 290 . . . . 288 . . 292 . . . . . . . . 138 248 352 156 255 143 227 278 141 258 354 159 260 146 237 290 150 263 . 161 266 149 247 295 152 . . 175 271 . . 298 . . . . . . . 307 . . . . . . . . 138 248 352 141 258 354 144 263 . 152 . . . . . . . . 22 23 24 25 9 26 376 221 105 187 124 327 99 177 298 376 221 105 187 124 324 99 177 296 376 221 105 187 124 333 106 179 298 376 221 105 193 124 327 106 179 301 376 221 105 193 124 327 106 177 298 376 221 105 193 124 327 90 177 293 376 221 105 379 . 109 193 127 330 . 179 301 382 230 . 193 133 327 112 179 301 . 230 109 193 130 . . 181 301 . 230 112 . . 330 112 182 304 . 224 112 196 127 330 112 179 301 . 224 112 196 136 333 99 179 298 379 224 112 382 . 112 199 130 333 . 183 307 . . . 199 . 333 . 182 328 . . . . 136 . . 182 328 . . . . . 333 . 194 307 . 227 . 199 136 333 . 197 328 . 230 . . . . 112 181 301 382 230 . . . . . . . . . . . . . . . . . 194 . . . . . . . . 183 . . . . . . . . 197 328 . 230 . . . . . . . . . . . . . . 197 328 . . . . . . . . . . . . . . . . . . . 197 . . . . . . . . 194 . . . . . . . . 208 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 260 143 227 278 159 266 146 237 284 161 288 149 241 287 . . . 243 290 . . . . 307 . . . . . 138 248 352 156 260 143 237 284 147 258 354 158 266 146 239 287 150 263 . 159 271 151 241 290 . . . 161 288 . . 295 . . . 164 . . . 307 . . . . . . . . 138 248 352 158 260 143 227 287 141 258 354 159 266 146 237 290 147 . . 161 288 149 239 295 . . . 175 . 151 248 307 . . . . . . . . . . . . . . . . 138 248 352 159 255 143 237 278 141 258 354 161 266 146 241 281 144 263 . 174 271 151 242 287 147 . . 175 . . 243 290 150 . . . . . 250 295 . . . . . . . . 138 248 352 159 255 143 227 278 147 258 354 161 260 146 237 287 150 263 . 174 266 149 242 290 152 . . . 271 . 250 295 . . . . . . . 307 . . . . . . . . 138 248 354 159 255 143 227 284 147 258 . 161 260 146 237 287 150 263 . 174 . 149 241 290 152 . . 175 . . 250 295 . . . . . . . . . . . . . . . . 138 248 349 159 260 143 141 255 354 161 266 146 150 258 . 164 277 . . . . 175 . . . . . . . . . . . . . . 187 124 324 193 127 327 196 133 330 . . 333 . . . . . . 227 287 237 290 241 295 . 301 . . . . ; DATA C; SET C1; F = FEMALE; DROP FEMALE; RUN; PROC SORT DATA=C; BY F; RUN; PROC SORT DATA=B; BY F; RUN; %MACRO D; *THIS FIRST LOOP/QUESTION DETERMINES PROGENY ALLELES THAT ARE NOT IN THE MOTHER; %DO A = 1 %TO %SSR %BY 1; *LOOP VALUES 1 TO SSR #; IF M1&A = . THEN DO; H1&A = .; H2&A = .; H3&A = .; H4&A = .; H5&A = .; H6&A = .; END; IF M1&A NE . THEN DO; FLAG1&A = 0; IF M1&A = P1&A THEN FLAG1&A = 1; IF M1&A = P2&A THEN FLAG1&A = 1; IF M1&A = P3&A THEN FLAG1&A = 1; IF M1&A = P4&A THEN FLAG1&A = 1; IF M1&A = P5&A THEN FLAG1&A = 1; IF M1&A = P6&A THEN FLAG1&A = 1; IF FLAG1&A = 0 THEN H1&A = M1&A; IF FLAG1&A = 1 THEN H1&A = .; FLAG2&A = 0; IF M2&A = P1&A THEN FLAG2&A = 1; IF M2&A = P2&A THEN FLAG2&A = 1; IF M2&A = P3&A THEN FLAG2&A = 1; IF M2&A = P4&A THEN FLAG2&A = 1; IF M2&A = P5&A THEN FLAG2&A = 1; IF M2&A = P6&A THEN FLAG2&A = 1; IF FLAG2&A = 0 THEN H2&A = M2&A; IF FLAG2&A = 1 THEN H2&A = .; FLAG3&A = 0; IF M3&A = P1&A THEN FLAG3&A = 1; IF M3&A = P2&A THEN FLAG3&A = 1; IF M3&A = P3&A THEN FLAG3&A = 1; IF M3&A = P4&A THEN FLAG3&A = 1; IF M3&A = P5&A THEN FLAG3&A = 1; IF M3&A = P6&A THEN FLAG3&A = 1; IF FLAG3&A = 0 THEN H3&A = M3&A; IF FLAG3&A = 1 THEN H3&A = .; FLAG4&A = 0; IF M4&A = P1&A THEN FLAG4&A = 1; IF M4&A = P2&A IF M4&A = P3&A IF M4&A = P4&A IF M4&A = P5&A IF M4&A = P6&A IF FLAG4&A = 0 IF FLAG4&A = 1 FLAG5&A = 0; IF M5&A = P1&A IF M5&A = P2&A IF M5&A = P3&A IF M5&A = P4&A IF M5&A = P5&A IF M5&A = P6&A IF FLAG5&A = 0 IF FLAG5&A = 1 FLAG6&A = 0; IF M6&A = P1&A IF M6&A = P2&A IF M6&A = P3&A IF M6&A = P4&A IF M6&A = P5&A IF M6&A = P6&A IF FLAG6&A = 0 IF FLAG6&A = 1 THEN THEN THEN THEN THEN THEN THEN FLAG4&A = 1; FLAG4&A = 1; FLAG4&A = 1; FLAG4&A = 1; FLAG4&A = 1; H4&A = M4&A; H4&A = .; THEN THEN THEN THEN THEN THEN THEN THEN FLAG5&A = 1; FLAG5&A = 1; FLAG5&A = 1; FLAG5&A = 1; FLAG5&A = 1; FLAG5&A = 1; H5&A = M5&A; H5&A = .; THEN THEN THEN THEN THEN THEN THEN THEN FLAG6&A = 1; FLAG6&A = 1; FLAG6&A = 1; FLAG6&A = 1; FLAG6&A = 1; FLAG6&A = 1; H6&A = M6&A; H6&A = .; END; * THIS SECTION CREATES/FORMATES THE PATERNAL HAPLOTYPE DATA SETS OF ALLELES THAT CAN NOT BE FROM THE MOTHER; IF H1&A = . THEN DO; H1&A = H2&A; H2&A = H3&A; H3&A = H4&A; H4&A = H5&A; H5&A = H6&A; H6&A = .; END; IF H1&A = . THEN DO; H1&A = H2&A; H2&A = H3&A; H3&A = H4&A; H4&A = H5&A; H5&A = H6&A; H6&A = .; END; IF H1&A = . THEN DO; H1&A = H2&A; H2&A = H3&A; H3&A = H4&A; H4&A = H5&A; H5&A = H6&A; H6&A = .; END; IF H1&A = . THEN DO; H1&A = H2&A; H2&A = H3&A; H3&A = H4&A; H4&A = H5&A; H5&A = H6&A; H6&A = .; END; IF H1&A = . THEN DO; H1&A = H2&A; H2&A = H3&A; H3&A = H4&A; H4&A = H5&A; H5&A = H6&A; H6&A = .; END; IF H1&A NE . THEN DO; IF H2&A = . THEN DO; H2&A = H3&A; H3&A = H4&A; H4&A = H5&A; H5&A = H6&A; H6&A = .; END; IF H2&A = . THEN DO; H2&A = H3&A; H3&A = H4&A; H4&A = H5&A; H5&A = H6&A; H6&A = .; END; IF H2&A = . THEN DO; H2&A = H3&A; H3&A = H4&A; H4&A = H5&A; H5&A = H6&A; H6&A = .; END; IF H2&A = . THEN DO; H2&A = H3&A; H3&A = H4&A; H4&A = H5&A; H5&A = H6&A; H6&A = .; END; IF H2&A NE . THEN DO; IF H3&A = . THEN DO; H3&A = H4&A; H4&A = H5&A; H5&A = H6&A; H6&A = .; END; IF H3&A = . THEN DO; H3&A = H4&A; H4&A = H5&A; H5&A = H6&A; H6&A = .; END; IF H3&A = . THEN DO; H3&A = H4&A; H4&A = H5&A; H5&A = H6&A; H6&A = .; END; IF H3&A NE . THEN DO; IF H4&A = . THEN DO; H4&A = H5&A; H5&A = H6&A; H6&A = .; END; IF H4&A = . THEN DO; H4&A = H5&A; H5&A = H6&A; H6&A = .; END; IF H4&A NE . THEN DO; IF H5&A = . THEN DO; H5&A = H6&A; H6&A = .; END; END; END; END; END; ERROR&A = 0; * THIS QUETION DETERMINES IF THREE ALLELES OR MORE WERE DERIVED FROM THE FATHER, THIS IS AN IMPOSSIBLE SITUATION, IN THIS CASE THE MARKER IS SET AS UNINFORMATIVE AND A ERROR IS NOTED FOR THE ERROR COUNT; IF H4&A NE . THEN DO; ERROR&A = 1; H1&A = .; H2&A = .; H3&A = .; END; DROP FLAG1&A FLAG2&A FLAG3&A FLAG4&A H4&A H5&A H6&A; %END; %MEND D; *DATA SET D MERGES PROGENY AND PARENTAL DATA SETS AND GENERATES HAPLOTYPIC INFORMATION; DATA D; MERGE B C; BY F; %D; DUMB = 1; IF ID = '' THEN DELETE; *DELETES PARENT LINES FOR FATHERS THAT DO NOT SERVE AS MOTHERS; RUN; %MACRO A; *THIS MACRO CREATES THE PARENTAL ALLELE VARIABLES FOR EVERY SSR TO COMPARE TO PROGENY; %DO A = 1 %TO %FAT %BY 1; *LOOP VALUES 1 TO FATHERS #; %DO B = 1 %TO %SSR %BY 1; *LOOP VALUES SSR 1 TO SSR #; %IF &B < 10 %THEN %DO; DATA E0&B&A; SET C; IF F NE &A THEN DELETE; A10&B&A = P1&B; A20&B&A = P2&B; A30&B&A = P3&B; A40&B&A = P4&B; A50&B&A = P5&B; A60&B&A = P6&B; DUMB = 1; KEEP A10&B&A A20&B&A A30&B&A A40&B&A A50&B&A A60&B&A DUMB; RUN; %END; %ELSE %DO; DATA E&B&A; SET C; IF F NE &A THEN DELETE; A1&B&A = P1&B; A2&B&A = P2&B; A3&B&A = P3&B; A4&B&A = P4&B; A5&B&A = P5&B; A6&B&A = P6&B; DUMB = 1; KEEP A1&B&A A2&B&A A3&B&A A4&B&A A5&B&A A6&B&A DUMB; RUN; %END; %END; %END; %MEND A; %A; %MACRO B; %DO A = 1 %TO %FAT %BY 1; %DO B = 1 %TO %SSR %BY 1; %IF &B < 10 %THEN %DO; E0&B&A %END; %ELSE %DO; E&B&A %END; %END; %END; %MEND B; *DATA SET F MERGES MACRO READY PARENT INFORMATION WITH PROGENY/HAPLOTYPE INFORMATION; DATA F; MERGE %B; BY DUMB; DROP FEMALE; RUN; PROC PRINT; RUN; *THIS MACRO GENERATES CHECK VARIABLES AND VALUES; %MACRO D; %LET C = %FAT; %DO A = 1 %TO %SSR %BY 1; CHECK&A = %IF &A < 10 %THEN %DO; %DO B = 1 %TO %FAT-1 %BY 1; C0&A&B + %END; C0&A&C; %END; %ELSE %DO; %DO B = 1 %TO %FAT-1 %BY 1; C&A&B + %END; C&A&C; %END; %END; %MEND D; %MACRO E; %DO B = 1 %TO %SSR-1 %BY 1; %IF &B < 10 %THEN %DO; C0&B&A, %END; %ELSE %DO; C&B&A, %END; %END; %LET C = %EVAL(%SSR)&A; %IF %SSR < 10 %THEN %DO; C0&C %END; %ELSE %DO; C&C %END; %MEND E; %MACRO F; %DO A = 1 %TO %SSR-1 %BY 1; ERROR&A + %END; ERROR%SSR %MEND F; %MACRO G1; %DO A = 1 %TO %SSR %BY 1; GOOD&A = 0; IF M1&A NE '.' THEN GOOD&A = 1; %END; %MEND G1; %MACRO G2; %DO A = 1 %TO %SSR %BY 1; %IF &A NE %SSR %THEN %DO; GOOD&A, %END; %ELSE %DO; GOOD&A %END; %END; %MEND G2; %MACRO H; %DO A = 1 %TO %SSR-1 %BY 1; SAME&A, %END; %LET B = %SSR; SAME&B %MEND H; *DATA SET G DOES THE PATERNITY TEST; DATA G; MERGE D F; BY DUMB; %MACRO C; %DO B = 1 %TO %SSR %BY 1; *LOOP 1 TO SSR #; %IF &B < 10 %THEN %DO; %DO A = 1 %TO %FAT %BY 1; *LOOP 1 TO FATHER #; C0&B&A = 0; *INITIAL SET OF COUNTER TO ZERO, I.E. ALL PARENTS ARE ASSUMED TO BE EXCLUDED UNTIL PROVEN OTHERWISE, IF C IS SWITCHED TO 1 FOR A PRAENT/SSR THIS PARENT IS NOT EXCLUDED; SAME&B = 0; *INITIAL SET OF SAME TO ZERO, THIS IS FOR SELF POLLINATION ANALYSIS IGNORE; %END; *UNINFORMATIVE PATERNAL HAPLOTYPE; IF H1&B = . THEN DO; %DO A = 1 %TO %FAT %BY 1; C0&B&A = 1; SAME&B = 1; %END; END; *INFORMATIVE HAPLOTYPE 1 UNIQUE PATERNAL ALLELE; IF H1&B NE . THEN DO; IF H2&B = . THEN DO; %DO A = 1 %TO %FAT %BY 1; IF H1&B = A10&B&A THEN C0&B&A = 1; IF H1&B = A20&B&A THEN C0&B&A = 1; IF H1&B = A30&B&A THEN C0&B&A = 1; IF H1&B = A40&B&A THEN C0&B&A = 1; IF H1&B = A50&B&A THEN C0&B&A = 1; IF H1&B = A60&B&A THEN C0&B&A = 1; %END; END; *INFORMATIVE HAPLOTYPE 2 UNIQUE PATERNAL ALLELES; IF H2&B NE . THEN DO; IF H3&B = . THEN DO; %DO A = 1 %TO %FAT %BY 1; FLAG10&B&A = 0; FLAG20&B&A = 0; FLAG30&B&A = 0; FLAG40&B&A = 0; FLAG50&B&A = 0; FLAG60&B&A = 0; IF H1&B = A10&B&A THEN FLAG10&B&A = 1; IF H1&B = A20&B&A THEN FLAG20&B&A = 1; IF H1&B = A30&B&A THEN FLAG30&B&A = 1; IF H1&B = A40&B&A THEN FLAG40&B&A = 1; IF H1&B = A50&B&A THEN FLAG50&B&A = 1; IF H1&B = A60&B&A THEN FLAG60&B&A = 1; IF H2&B = A10&B&A THEN FLAG10&B&A = 1; IF H2&B = A20&B&A THEN FLAG20&B&A = 1; IF H2&B = A30&B&A THEN FLAG30&B&A = 1; IF H2&B = A40&B&A THEN FLAG40&B&A = 1; IF H2&B = A50&B&A THEN FLAG50&B&A = 1; IF H2&B = A60&B&A THEN FLAG60&B&A = 1; TEST0&B&A = FLAG10&B&A + FLAG20&B&A + FLAG30&B&A + FLAG40&B&A + FLAG50&B&A + FLAG60&B&A; IF TEST0&B&A = 2 THEN C0&B&A = 1; %END; END; *INFORMATIVE HAPLOYTPE 3 UNIQUE PATERNAL ALLELES; IF H3&B NE . THEN DO; %DO A = 1 %TO %FAT %BY 1; FLAG10&B&A = 0; FLAG20&B&A = 0; FLAG30&B&A = 0; FLAG40&B&A = 0; FLAG50&B&A = 0; FLAG60&B&A = 0; IF H1&B = A10&B&A THEN FLAG10&B&A = 1; IF H1&B = A20&B&A THEN FLAG20&B&A = 1; IF H1&B = A30&B&A THEN FLAG30&B&A = 1; IF H1&B = A40&B&A THEN FLAG40&B&A = 1; IF H1&B = A50&B&A THEN FLAG50&B&A = 1; IF H1&B = A60&B&A THEN FLAG60&B&A = 1; IF H2&B = A10&B&A THEN FLAG10&B&A = 1; IF H2&B = A20&B&A THEN FLAG20&B&A = 1; IF H2&B = A30&B&A THEN FLAG30&B&A = 1; IF H2&B = A40&B&A THEN FLAG40&B&A = 1; IF H2&B = A50&B&A THEN FLAG50&B&A = 1; IF H2&B = A60&B&A THEN FLAG60&B&A = 1; IF H3&B = A10&B&A THEN FLAG10&B&A = 1; IF H3&B = A20&B&A THEN FLAG20&B&A = 1; IF H3&B = A30&B&A THEN FLAG30&B&A = 1; IF H3&B = A40&B&A THEN FLAG40&B&A = 1; IF H3&B = A50&B&A THEN FLAG50&B&A = 1; IF H3&B = A60&B&A THEN FLAG60&B&A = 1; TEST0&B&A = FLAG10&B&A + FLAG20&B&A + FLAG30&B&A + FLAG40&B&A + FLAG50&B&A + FLAG60&B&A; IF TEST0&B&A = 3 THEN C0&B&A = 1; %END; END; END; END; %END; %ELSE %DO; %DO A = 1 %TO %FAT %BY 1; C&B&A = 0; SAME&B = 0; %END; *UNINFORMATIVE PATERNAL HAPLOTYPE; IF H1&B = . THEN DO; %DO A = 1 %TO %FAT %BY 1; C&B&A = 1; SAME&B = 1; %END; END; *INFORMATIVE HAPLOTYPE 1 UNIQUE PATERNAL ALLELE; IF H1&B NE . THEN DO; IF H2&B = . THEN DO; %DO A = 1 %TO %FAT %BY 1; IF H1&B = A1&B&A THEN C&B&A = 1; IF H1&B = A2&B&A THEN C&B&A = 1; IF H1&B = A3&B&A THEN C&B&A = 1; IF H1&B = A4&B&A THEN C&B&A = 1; IF H1&B = A5&B&A THEN C&B&A = 1; IF H1&B = A6&B&A THEN C&B&A = 1; %END; END; *INFORMATIVE HAPLOTYPE 2 UNIQUE PATERNAL ALLELE; IF H2&B NE . THEN DO; IF H3&B = . THEN DO; %DO A = 1 %TO %FAT %BY 1; FLAG1&B&A = 0; FLAG2&B&A = 0; FLAG3&B&A = 0; FLAG4&B&A = 0; FLAG5&B&A = 0; FLAG6&B&A = 0; IF H1&B = A1&B&A THEN FLAG1&B&A = 1; IF H1&B = A2&B&A THEN FLAG2&B&A = 1; IF H1&B = A3&B&A THEN FLAG3&B&A = 1; IF H1&B = A4&B&A THEN FLAG4&B&A = 1; IF H1&B = A5&B&A THEN FLAG5&B&A = 1; IF H1&B = A6&B&A THEN FLAG6&B&A = 1; IF H2&B = A1&B&A THEN FLAG1&B&A = 1; IF H2&B = A2&B&A THEN FLAG2&B&A = 1; IF H2&B = A3&B&A THEN FLAG3&B&A = 1; IF H2&B = A4&B&A THEN FLAG4&B&A = 1; IF H2&B = A5&B&A THEN FLAG5&B&A = 1; IF H2&B = A6&B&A THEN FLAG6&B&A = 1; TEST&B&A = FLAG1&B&A + FLAG2&B&A + FLAG3&B&A + FLAG4&B&A + FLAG5&B&A + FLAG6&B&A; IF TEST&B&A = 2 THEN C&B&A = 1; %END; END; *INFORMATIVE HAPLOTYPE 3 UNIQUE PATERNAL ALLELE; IF H3&B NE . THEN DO; %DO A = 1 %TO %FAT %BY 1; FLAG1&B&A = 0; FLAG2&B&A = 0; FLAG3&B&A = 0; FLAG4&B&A = 0; FLAG5&B&A = 0; FLAG6&B&A = 0; IF H1&B = A1&B&A THEN FLAG1&B&A = 1; IF H1&B = A2&B&A THEN FLAG2&B&A = 1; IF H1&B = A3&B&A THEN FLAG3&B&A = 1; IF H1&B = A4&B&A THEN FLAG4&B&A = 1; IF H1&B = A5&B&A THEN FLAG5&B&A = 1; IF H1&B = A6&B&A THEN FLAG6&B&A = 1; IF H2&B = A1&B&A THEN FLAG1&B&A = 1; IF H2&B = A2&B&A THEN FLAG2&B&A = 1; IF H2&B = A3&B&A THEN FLAG3&B&A = 1; IF H2&B = A4&B&A THEN FLAG4&B&A = 1; IF H2&B = A5&B&A THEN FLAG5&B&A = 1; IF H2&B = A6&B&A THEN FLAG6&B&A = 1; IF H3&B = A1&B&A THEN FLAG1&B&A = 1; IF H3&B = A2&B&A THEN FLAG2&B&A = 1; IF H3&B = A3&B&A THEN FLAG3&B&A = 1; IF H3&B = A4&B&A THEN FLAG4&B&A = 1; IF H3&B = A5&B&A THEN FLAG5&B&A = 1; IF H3&B = A6&B&A THEN FLAG6&B&A = 1; TEST&B&A = FLAG1&B&A + FLAG2&B&A + FLAG3&B&A + FLAG4&B&A + FLAG5&B&A + FLAG6&B&A; IF TEST&B&A = 3 THEN C&B&A = 1; %END; END; END; END; %END; %END; * THIS IS THE NUMBER OF SSR WHERE A PARTICULAR FATHER WAS NOT EXCLUDED; %DO A = 1 %TO %FAT %BY 1; *LOOP 1 TO FATHER #; CX&A = SUM(OF %E); %END; * THIS IS THE NUMBER OF NON-EXCLUDED FATHERS FOR EACH SSR; %D; %MEND C; %C; *THIS IS THE TOTAL ERROR COUNT ACROSS ALL SSR FOR EACH PROGENY; ERROR = %F; *THE SP VARIABLE IS THE COUNT OF A PROGENY’S SSR THAT HAVE AT LEAST ONE VISIBLE ALLELE; %G1; SP = SUM(OF %G2); IF SP < 5 THEN DELETE; *MINIMUM NUMBER OF SSR THAT HAVE TO BE VISIBLY AMPLIFIED IN A PROGENY FOR ANALYSIS; *THIS SECTION IS TO INDICATE POTENTIAL SELF-POLLINATIONS; SP1 = SUM(OF %H); SELF = 'NO '; IF SP1 = %SSR THEN SELF = 'YES'; RUN; *THIS SECTION CREATES THE "TYPE" AND "ALTERNATE" OUTPUT DISPLAYED TO THE USER; %MACRO I; %DO A = 1 %TO %SSR %BY 1; IF H1&A = . THEN INFSSR = INFSSR - 1; %END; %MEND I; %MACRO J; %DO A = 1 %TO %SSR %BY 1; IF CHECK&A = 0 THEN ZEROSSR = ZEROSSR + 1; %END; %MEND J; %MACRO K; %DO A = %SSR %TO 1 %BY -1; COUNT&A = 0; %DO B = 1 %TO %FAT %BY 1; IF CX&B = &A THEN COUNT&A = COUNT&A + 1; %END; %END; %MEND K; %MACRO L; %DO B = 1 %TO 7 %BY 1; %LET A&B = %EVAL(%SSR+1-&B); %END; IF SELF = 'YES' THEN DO; TYPE = 'POSSIBLE SELF-FERTILIZATION '; END; ELSE DO; IF COUNT&A1 > 1 THEN DO; TYPE = 'MULTI-FATHERS'; IF INFSSR = 1 THEN ALTERNATE = 'SELF 1SSR ERR '; END; IF COUNT&A1 = 1 THEN DO; TYPE = 'FATHER FOUND'; %DO D = 1 %TO %FAT %BY 1; IF CX&D = &A1 THEN DO; FATHER&A1 = &D; END; %END; IF COUNT&A2 = 0 THEN DO; TYPE = 'FATHER FOUND *'; IF COUNT&A3 = 0 THEN DO; TYPE = 'FATHER FOUND **'; IF COUNT&A4 = 0 THEN DO; TYPE = 'FATHER FOUND ***'; IF COUNT&A5 = 0 THEN DO; TYPE = 'FATHER FOUND ****'; IF COUNT&A6 = 0 THEN DO; TYPE = 'FATHER FOUND *****'; IF COUNT&A7 = 0 THEN TYPE = 'FATHER FOUND ******'; END; END; END; END; END; IF INFSSR = 1 THEN ALTERNATE = 'SELF 1SSR ERR'; END; IF COUNT&A1 = 0 THEN DO; TYPE = 'ALL FATHERS EXCLUDED'; IF COUNT&A2 > 1 THEN ALTERNATE = 'MULTI-FATHERS 1SSR ERR'; IF COUNT&A2 = 1 THEN DO; ALTERNATE = 'FATHER FOUND 1SSR ERR'; %DO D = 1 %TO %FAT %BY 1; IF CX&D = &A2 THEN DO; FATHER&A2 = &D; END; %END; IF COUNT&A3 = 0 THEN DO; ALTERNATE = 'FATHER FOUND 1SSR ERR *'; IF COUNT&A4 = 0 THEN DO; ALTERNATE = 'FATHER FOUND 1SSR ERR **'; IF COUNT&A5 = 0 THEN DO; ALTERNATE = 'FATHER FOUND 1SSR ERR ***'; IF COUNT&A6 = 0 THEN DO; ALTERNATE = 'FATHER FOUND 1SSR ERR ****'; IF COUNT&A7 = 0 THEN ALTERNATE = 'FATHER FOUND 1SSR ERR *****'; END; END; END; END; END; IF COUNT&A2 = 0 THEN DO; TYPE = 'ALL FATHERS EXCLUDED *'; IF COUNT&A3 > 1 THEN ALTERNATE = 'MULTI-FATHERS 2SSR ERR'; IF COUNT&A3 = 1 THEN DO; ALTERNATE = 'FATHER FOUND 2SSR ERR'; %DO D = 1 %TO %FAT %BY 1; IF CX&D = &A3 THEN DO; FATHER&A3 = &D; END; %END; IF COUNT&A4 = 0 THEN DO; ALTERNATE = 'FATHER FOUND 2SSR ERR *'; IF COUNT&A5 = 0 THEN DO; ALTERNATE = 'FATHER FOUND 2SSR ERR **'; IF COUNT&A6 = 0 THEN DO; ALTERNATE = 'FATHER FOUND 2SSR ERR ***'; IF COUNT&A7 = 0 THEN ALTERNATE = 'FATHER FOUND 2SSR ERR ****'; END; END; END; END; IF COUNT&A3 = 0 THEN DO; TYPE = 'ALL FATHERS EXCLUDED **'; IF COUNT&A4 > 1 THEN ALTERNATE = 'MULTI-FATHERS 3SSR ERR'; IF COUNT&A4 = 1 THEN DO; ALTERNATE = 'FATHER FOUND 3SSR ERR'; %DO D = 1 %TO %FAT %BY 1; IF CX&D = &A4 THEN DO; FATHER&A4 = &D; END; %END; IF COUNT&A5 = 0 THEN DO; ALTERNATE = 'FATHER FOUND 3SSR ERR *'; IF COUNT&A6 = 0 THEN DO; ALTERNATE = 'FATHER FOUND 3SSR ERR **'; IF COUNT&A7 = 0 THEN ALTERNATE = 'FATHER FOUND 3SSR ERR ***'; END; END; END; IF COUNT&A4 = 0 THEN DO; TYPE = 'ALL FATHERS EXCLUDED ***'; IF COUNT&A5 = 0 THEN DO; TYPE = 'ALL FATHERS EXCLUDED ****'; IF COUNT&A6 = 0 THEN DO; TYPE = 'ALL FATHERS EXCLUDED *****'; IF COUNT&A7 = 0 THEN TYPE = 'ALL FATHERS EXCLUDED ******'; END; END; END; END; END; END; END; IF SELF = 'YES' THEN FATHER = FEMALE; *IT IS CRITICAL THAT THIS IS ADJUSTED FOR UNQIUE DATA SETS, THIS SECTION CONVERTS SEQUENTIAL FATHER NUMBER INTO FATHER NAME; IF FATHER&A1 = 1 THEN FATHER = '1'; IF FATHER&A1 = 2 THEN FATHER = '2'; IF FATHER&A1 = 3 THEN FATHER = '3'; IF FATHER&A1 = 4 THEN FATHER = '4'; IF FATHER&A1 = 5 THEN FATHER = '5'; IF FATHER&A1 = 6 THEN FATHER = '6'; IF FATHER&A1 = 7 THEN FATHER = '7'; IF FATHER&A1 = 8 THEN FATHER = '8'; IF FATHER&A1 = 9 THEN FATHER = '9'; IF FATHER&A1 = 10 THEN FATHER = '10'; IF FATHER&A1 = 11 THEN FATHER = '11'; IF FATHER&A1 = 12 THEN FATHER = '12'; IF FATHER&A1 = 13 THEN FATHER = '13'; IF FATHER&A1 = 14 THEN FATHER = '14'; IF FATHER&A1 = 15 THEN FATHER = '15'; IF FATHER&A1 = 16 THEN FATHER = '16'; IF FATHER&A1 = 17 THEN FATHER = '17'; IF FATHER&A1 = 18 THEN FATHER = '18'; IF FATHER&A1 = 19 THEN FATHER = '19'; IF FATHER&A1 = 20 THEN FATHER = '20'; IF FATHER&A1 = 21 THEN FATHER = '21'; IF FATHER&A1 = 22 THEN FATHER = '22'; IF FATHER&A1 = 23 THEN FATHER = '23'; IF FATHER&A1 = 24 THEN FATHER = '24'; IF FATHER&A1 = 25 THEN FATHER = '25'; IF FATHER&A1 = 26 THEN FATHER = '26'; %MEND L; DATA H; SET G; INFSSR = %SSR; %I; ZEROSSR = 0; %J; %K; %L; RUN; %MACRO M; %DO A = %SSR %TO %SSR-3 %BY -1; FATHER&A %END; %DO B = 1 %TO %FAT %BY 1; CX&B %END; %DO C = 1 %TO %SSR %BY 1; CHECK&C %END; %DO D = 1 %TO %SSR %BY 1; COUNT&D %END; %DO E = 1 %TO %SSR %BY 1; %DO F = 1 %TO 3 %BY 1; H&F&E %END; %END; %MEND M; *THIS STEP RETAINS ALL OUTPUT VARIABLES THAT WILL BE EXPORTED TO EXCEL OUTPUT FILE; DATA I; RETAIN ROW PLANT ID F FEMALE FATHER SELF SP ERROR ZEROSSR INFSSR TYPE ALTERNATE %M; SET H; KEEP ROW PLANT ID F FEMALE FATHER SELF SP ERROR ZEROSSR INFSSR TYPE ALTERNATE %M; RUN; *EXPORTS DATA TO EXCEL SPREADSHEET FILE, IF RESULTS.XLS FILE EXISTS THIS WILL OVERWRITE EXISTING FILE WITHOUT PROMPTING; *CHANGE EXPORT PATH AND FILE NAME AS DESIRED; PROC EXPORT DATA= WORK.IX OUTFILE= "RESULTS.xls" DBMS=EXCEL5 REPLACE; RUN;