Special Binding Data

Frequent Contributor
Posts: 115

Special Binding Data

Good morning my SAS friends:

Here i come to be helped, well let me show you this case:

Was made an experiment having 5 observations, the data of the first one was obtained numerically ordered, but the rest was not, even though the number in the second sampling time was bigger that the first sampling, like that:

Data FirstSampling:

input Sample Observ1;

cards;

9    14.00

10    17.00

11    11.00

12    11.00

13    14.00

14    14.00

15    13.00

16    12.00

17    12.00

;

Data SecondSampling;

input Sample    Observ2    Observ3    Observ4    Observ5;

vcards;

1    25.00    6.99    2.64    1.40

4    27.00    7.16    2.68    1.43

12    45.00    8.27    2.88    1.65

7    36.00    7.78    2.79    1.56

13    24.00    6.90    2.63    1.38

5    87.00    9.70    3.11    1.94

6    34.00    7.66    2.77    1.53

11    72.00    9.29    3.05    1.86

2    13.00    5.57    2.36    1.11

10    15.00    5.88    2.42    1.18

8    24.00    6.90    2.63    1.38

18    31.00    7.46    2.73    1.49

17    23.00    6.81    2.61    1.36

3    23.00    6.81    2.61    1.36

16    23.00    6.81    2.61    1.36

15    34.00    7.66    2.77    1.53

9    26.00    7.07    2.66    1.41

19    21.00    6.61    2.57    1.32

20    11.00    5.21    2.28    1.04

14    34.00    7.66    2.77    1.53

;

So here is the problem: that i would like to bind these two datasets, and obtains something like that:

 Sample Observ1 Observ2 Observ3 Observ4 Observ5 1 . 25.00 6.99 2.64 1.40 2 . 13.00 5.57 2.36 1.11 3 . 23.00 6.81 2.61 1.36 4 . 27.00 7.16 2.68 1.43 5 . 87.00 9.70 3.11 1.94 6 . 34.00 7.66 2.77 1.53 7 . 36.00 7.78 2.79 1.56 8 . 24.00 6.90 2.63 1.38 9 14.00 26.00 7.07 2.66 1.41 10 17.00 15.00 5.88 2.42 1.18 11 11.00 72.00 9.29 3.05 1.86 12 11.00 45.00 8.27 2.88 1.65 13 14.00 24.00 6.90 2.63 1.38 14 14.00 34.00 7.66 2.77 1.53 15 13.00 34.00 7.66 2.77 1.53 16 12.00 23.00 6.81 2.61 1.36 17 12.00 23.00 6.81 2.61 1.36 18 . 31.00 7.46 2.73 1.49 19 . 21.00 6.61 2.57 1.32 20 . 11.00 5.21 2.28 1.04

Thank you very much

Super Contributor
Posts: 275

Re: Special Binding Data

proc sort data=SecondSampling;

by sample;

run;

data want;

merge FirstSampling SecondSampling;

by sample;

run;

Discussion stats