DATA Step, Macro, Functions and more

problem with data input on simple distance matrix- any suggestions?

Reply
N/A
Posts: 0

problem with data input on simple distance matrix- any suggestions?

Hi,
I just can't figure out what the problem is with this simple data input is. The program is below, and under that is the log error message I get.

Any sugguestions? This should be really simple...

thanks - JDB



data rmatrix (type = distance);
input name $ _1 _2 _3 _4 _5 _6 _7 _8 _9 _10 _11 _12 _13 _14 _15 _16
_17 _18 _19 _20 _21 _22 _23 _24 _25 _26 _27 _28 _29 _30
_34 _32 _35 _36 _37 _38 _39 _KG1 _KG2 _KG3 _KG4 _KG5 _KG6;
datalines;

1 0.000
2 0.478 0.000
3 0.432 0.589 0.000
4 0.468 0.548 0.500 0.000
5 0.472 0.557 0.542 0.594 0.000
6 0.566 0.580 0.530 0.533 0.570 0.000
7 0.598 0.514 0.620 0.670 0.436 0.534 0.000
8 0.288 0.444 0.659 0.437 0.552 0.464 0.676 0.000
9 0.474 0.512 0.563 0.421 0.556 0.453 0.588 0.543 0.000
10 0.639 0.570 0.608 0.557 0.423 0.429 0.575 0.526 0.598 0.000
11 0.556 0.620 0.516 0.582 0.593 0.583 0.572 0.479 0.570 0.493 0.000
12 0.490 0.547 0.343 0.560 0.593 0.614 0.574 0.609 0.573 0.583 0.262 0.000
13 0.562 0.656 0.481 0.510 0.545 0.440 0.579 0.515 0.603 0.432 0.275 0.353 0.000
14 0.485 0.550 0.439 0.617 0.463 0.410 0.527 0.571 0.515 0.245 0.474 0.537 0.567 0.000
15 0.343 0.546 0.575 0.533 0.513 0.624 0.607 0.373 0.578 0.658 0.347 0.477 0.466 0.631 0.000
16 0.579 0.615 0.438 0.580 0.590 0.611 0.548 0.678 0.418 0.580 0.309 0.285 0.454 0.508 0.529 0.000
17 0.651 0.614 0.546 0.498 0.449 0.452 0.591 0.551 0.585 0.237 0.295 0.395 0.372 0.462 0.547 0.368 0.000
18 0.497 0.538 0.569 0.511 0.535 0.627 0.655 0.467 0.462 0.515 0.182 0.264 0.307 0.566 0.456 0.353 0.264 0.000
19 0.506 0.659 0.439 0.644 0.397 0.464 0.466 0.605 0.605 0.291 0.466 0.451 0.278 0.279 0.561 0.530 0.453 0.489 0.000
20 0.456 0.619 0.423 0.374 0.460 0.435 0.568 0.567 0.423 0.395 0.441 0.422 0.281 0.442 0.533 0.448 0.322 0.402 0.432 0.000
21 0.434 0.606 0.447 0.460 0.605 0.488 0.555 0.519 0.493 0.660 0.277 0.304 0.235 0.479 0.470 0.431 0.523 0.298 0.470 0.325 0.000
22 0.579 0.567 0.354 0.511 0.469 0.382 0.500 0.589 0.643 0.498 0.552 0.464 0.532 0.429 0.638 0.485 0.392 0.557 0.475 0.490 0.509 0.000
23 0.565 0.600 0.497 0.499 0.599 0.514 0.466 0.586 0.585 0.643 0.538 0.409 0.391 0.622 0.566 0.517 0.604 0.528 0.488 0.518 0.419 0.495 0.000
24 0.538 0.452 0.535 0.563 0.471 0.479 0.554 0.507 0.470 0.474 0.559 0.466 0.565 0.456 0.593 0.488 0.443 0.459 0.564 0.453 0.486 0.439 0.475 0.000
25 0.564 0.474 0.469 0.564 0.494 0.391 0.580 0.537 0.611 0.410 0.451 0.463 0.538 0.366 0.596 0.535 0.382 0.510 0.535 0.540 0.512 0.386 0.545 0.461 0.000
26 0.439 0.494 0.524 0.575 0.418 0.448 0.497 0.526 0.388 0.441 0.573 0.484 0.605 0.400 0.579 0.527 0.464 0.504 0.471 0.475 0.557 0.481 0.580 0.296 0.407 0.000
27 0.395 0.550 0.451 0.490 0.445 0.569 0.479 0.464 0.338 0.617 0.378 0.466 0.537 0.374 0.506 0.393 0.551 0.485 0.477 0.422 0.403 0.487 0.521 0.490 0.461 0.483 0.000
28 0.400 0.515 0.453 0.582 0.483 0.613 0.545 0.437 0.631 0.582 0.494 0.477 0.647 0.559 0.429 0.500 0.483 0.499 0.619 0.561 0.621 0.423 0.561 0.503 0.501 0.470 0.503 0.000
29 0.493 0.579 0.471 0.518 0.500 0.597 0.483 0.578 0.527 0.622 0.511 0.469 0.570 0.656 0.510 0.419 0.473 0.501 0.569 0.607 0.545 0.466 0.501 0.519 0.518 0.510 0.519 0.290 0.000
30 0.630 0.635 0.493 0.476 0.487 0.624 0.525 0.638 0.630 0.504 0.583 0.545 0.623 0.626 0.490 0.542 0.450 0.565 0.591 0.566 0.718 0.458 0.580 0.460 0.531 0.482 0.698 0.249 0.346 0.000
34 0.487 0.556 0.550 0.488 0.434 0.441 0.532 0.395 0.623 0.432 0.476 0.570 0.510 0.479 0.471 0.539 0.368 0.525 0.505 0.511 0.547 0.483 0.523 0.486 0.452 0.506 0.457 0.502 0.402 0.501 0.000
32 0.436 0.655 0.472 0.571 0.316 0.440 0.375 0.501 0.488 0.405 0.412 0.459 0.241 0.457 0.576 0.480 0.412 0.479 0.182 0.370 0.373 0.503 0.554 0.553 0.376 0.451 0.323 0.538 0.310 0.528 0.425 0.000
35 0.604 0.592 0.528 0.554 0.511 0.142 0.493 0.526 0.591 0.460 0.604 0.504 0.527 0.500 0.613 0.600 0.430 0.609 0.494 0.497 0.559 0.379 0.512 0.401 0.341 0.376 0.635 0.548 0.534 0.490 0.503 0.440 0.000
36 0.549 0.687 0.441 0.520 0.681 0.449 0.573 0.611 0.466 0.536 0.330 0.435 0.403 0.485 0.509 0.294 0.451 0.454 0.510 0.433 0.449 0.555 0.514 0.607 0.486 0.602 0.451 0.606 0.531 0.618 0.409 0.413 0.629 0.000
37 0.477 0.488 0.522 0.529 0.593 0.493 0.545 0.492 0.629 0.487 0.466 0.503 0.647 0.438 0.460 0.551 0.424 0.528 0.555 0.593 0.560 0.499 0.612 0.449 0.472 0.444 0.503 0.460 0.452 0.457 0.216 0.574 0.408 0.456 0.000
38 0.466 0.575 0.621 0.574 0.490 0.273 0.485 0.453 0.467 0.456 0.593 0.593 0.540 0.558 0.476 0.574 0.511 0.609 0.437 0.481 0.638 0.602 0.522 0.585 0.529 0.470 0.606 0.469 0.435 0.556 0.501 0.365 0.297 0.602 0.578 0.000
39 0.514 0.634 0.497 0.564 0.584 0.432 0.483 0.532 0.418 0.596 0.451 0.415 0.532 0.575 0.529 0.396 0.429 0.468 0.575 0.479 0.508 0.473 0.494 0.499 0.600 0.470 0.466 0.520 0.391 0.535 0.329 0.576 0.514 0.311 0.331 0.479 0.000
KG1 0.612 0.545 0.540 0.531 0.451 0.562 0.630 0.464 0.501 0.481 0.547 0.482 0.616 0.481 0.549 0.547 0.490 0.498 0.601 0.493 0.562 0.562 0.520 0.387 0.570 0.492 0.557 0.524 0.657 0.503 0.513 0.687 0.590 0.594 0.590 0.515 0.473 0.000
KG2 0.599 0.509 0.643 0.625 0.409 0.642 0.522 0.547 0.458 0.502 0.467 0.477 0.628 0.563 0.491 0.388 0.420 0.370 0.562 0.554 0.605 0.510 0.463 0.230 0.513 0.394 0.530 0.435 0.407 0.443 0.598 0.607 0.528 0.656 0.632 0.447 0.554 0.389 0.000
KG3 0.525 0.459 0.407 0.552 0.548 0.536 0.648 0.492 0.507 0.527 0.436 0.353 0.490 0.453 0.599 0.478 0.414 0.283 0.589 0.349 0.410 0.483 0.600 0.265 0.484 0.410 0.425 0.480 0.643 0.522 0.540 0.621 0.526 0.545 0.499 0.659 0.532 0.307 0.395 0.000
KG4 0.648 0.536 0.586 0.561 0.573 0.535 0.621 0.519 0.596 0.424 0.357 0.409 0.447 0.516 0.575 0.493 0.285 0.239 0.566 0.352 0.474 0.491 0.564 0.306 0.413 0.462 0.563 0.492 0.664 0.430 0.541 0.579 0.465 0.492 0.468 0.622 0.575 0.468 0.305 0.110 0.000
KG5 0.583 0.505 0.521 0.598 0.475 0.599 0.579 0.535 0.518 0.528 0.507 0.425 0.581 0.540 0.530 0.531 0.472 0.375 0.580 0.508 0.549 0.498 0.519 0.318 0.559 0.465 0.540 0.504 0.632 0.489 0.615 0.726 0.550 0.609 0.574 0.625 0.564 0.269 0.196 0.137 0.157 0.000
KG6 0.508 0.513 0.418 0.565 0.509 0.548 0.603 0.498 0.418 0.475 0.553 0.522 0.552 0.434 0.653 0.550 0.520 0.325 0.455 0.531 0.532 0.567 0.620 0.409 0.577 0.380 0.494 0.573 0.683 0.597 0.655 0.605 0.540 0.561 0.567 0.627 0.613 0.408 0.370 0.195 0.230 0.158 0.000
;

/*---------------------- Average linkage --------------------*/
proc cluster data=rmatrix method=average pseudo;
id name;
run;

proc tree horizontal spaces=2;
id name;
run;

Errors from Log:


938
939 title 'CLUSTER ANALYSIS OF Ostrich relatedness values';


940 data rmatrix (type = distance);
941 input name $ _1 _2 _3 _4 _5 _6 _7 _8 _9 _10 _11 _12 _13 _14 _15 _16
942 _17 _18 _19 _20 _21 _22 _23 _24 _25 _26 _27 _28 _29 _30
943 _34 _32 _35 _36 _37 _38 _39 _KG1 _KG2 _KG3 _KG4 _KG5 _KG6;
944 datalines;

NOTE: Invalid data for _KG2 in line 984 1-3.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+
984 KG2 0.599 0.509 0.643 0.625 0.409 0.642 0.522 0.547 0.458 0.502 0.467 0.477 0.628 0.5
86 63 0.491 0.388 0.420 0.370 0.562 0.554 0.605 0.510 0.463 0.230 0.513 0.394 0.530 0.43
171 5 0.407 0.443 0.598 0.607 0.528 0.656 0.632 0.447 0.554 0.389 0.000
name=KG1 _1=0.612 _2=0.545 _3=0.54 _4=0.531 _5=0.451 _6=0.562 _7=0.63 _8=0.464 _9=0.501
_10=0.481 _11=0.547 _12=0.482 _13=0.616 _14=0.481 _15=0.549 _16=0.547 _17=0.49 _18=0.498
_19=0.601 _20=0.493 _21=0.562 _22=0.562 _23=0.52 _24=0.387 _25=0.57 _26=0.492 _27=0.557
_28=0.524 _29=0.657 _30=0.503 _34=0.513 _32=0.687 _35=0.59 _36=0.594 _37=0.59 _38=0.515
_39=0.473 _KG1=0 _KG2=. _KG3=0.599 _KG4=0.509 _KG5=0.643 _KG6=0.625 _ERROR_=1 _N_=14
NOTE: Invalid data for _KG4 in line 986 1-3.
986 KG4 0.648 0.536 0.586 0.561 0.573 0.535 0.621 0.519 0.596 0.424 0.357 0.409 0.447 0.5
86 16 0.575 0.493 0.285 0.239 0.566 0.352 0.474 0.491 0.564 0.306 0.413 0.462 0.563 0.49
171 2 0.664 0.430 0.541 0.579 0.465 0.492 0.468 0.622 0.575 0.468 0.305 0.110 0.000
name=KG3 _1=0.525 _2=0.459 _3=0.407 _4=0.552 _5=0.548 _6=0.536 _7=0.648 _8=0.492 _9=0.507
_10=0.527 _11=0.436 _12=0.353 _13=0.49 _14=0.453 _15=0.599 _16=0.478 _17=0.414 _18=0.283
_19=0.589 _20=0.349 _21=0.41 _22=0.483 _23=0.6 _24=0.265 _25=0.484 _26=0.41 _27=0.425 _28=0.48
_29=0.643 _30=0.522 _34=0.54 _32=0.621 _35=0.526 _36=0.545 _37=0.499 _38=0.659 _39=0.532
_KG1=0.307 _KG2=0.395 _KG3=0 _KG4=. _KG5=0.648 _KG6=0.536 _ERROR_=1 _N_=15
NOTE: Invalid data for _KG6 in line 988 1-3.
988 KG6 0.508 0.513 0.418 0.565 0.509 0.548 0.603 0.498 0.418 0.475 0.553 0.522 0.552 0.4
86 34 0.653 0.550 0.520 0.325 0.455 0.531 0.532 0.567 0.620 0.409 0.577 0.380 0.494 0.57
171 3 0.683 0.597 0.655 0.605 0.540 0.561 0.567 0.627 0.613 0.408 0.370 0.195 0.230 0.158
256 0.000
name=KG5 _1=0.583 _2=0.505 _3=0.521 _4=0.598 _5=0.475 _6=0.599 _7=0.579 _8=0.535 _9=0.518
_10=0.528 _11=0.507 _12=0.425 _13=0.581 _14=0.54 _15=0.53 _16=0.531 _17=0.472 _18=0.375 _19=0.58
_20=0.508 _21=0.549 _22=0.498 _23=0.519 _24=0.318 _25=0.559 _26=0.465 _27=0.54 _28=0.504
_29=0.632 _30=0.489 _34=0.615 _32=0.726 _35=0.55 _36=0.609 _37=0.574 _38=0.625 _39=0.564
_KG1=0.269 _KG2=0.196 _KG3=0.137 _KG4=0.157 _KG5=0 _KG6=. _ERROR_=1 _N_=16
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.RMATRIX has 16 observations and 44 variables.
NOTE: DATA statement used (Total process time):
real time 0.14 seconds
cpu time 0.06 seconds


989 ;
990
991 /*---------------------- Average linkage --------------------*/
992 proc cluster data=rmatrix method=average pseudo;
993 id name;
994 run;

ERROR: For distance data, the number of observations in the data set or by-group (16) must
equal the number of variables (43).
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.DATA16 may be incomplete. When this step was stopped there were 0
observations and 11 variables.
NOTE: PROCEDURE CLUSTER used (Total process time):
real time 0.07 seconds
cpu time 0.04 seconds

995


996 proc tree horizontal spaces=2;
997 id name;
998 run;

NOTE: No observations in data set WORK.DATA16.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE TREE used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds
Respected Advisor
Posts: 3,900

Re: problem with data input on simple distance matrix- any suggestions?

That's the issue:
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.

Use TRUNCOVER.

HTH
Patrick

data rmatrix (type = distance);
infile datalines truncover;
input name $ _1 _2 _3 _4 _5 _6 _7 _8 _9 _10 _11 _12 _13 _14 _15 _16
_17 _18 _19 _20 _21 _22 _23 _24 _25 _26 _27 _28 _29 _30
_34 _32 _35 _36 _37 _38 _39 _KG1 _KG2 _KG3 _KG4 _KG5 _KG6;
datalines;

1 0.000
Ask a Question
Discussion stats
  • 1 reply
  • 99 views
  • 0 likes
  • 2 in conversation