Help using Base SAS procedures

Special Binding Data

Reply
Frequent Contributor
Posts: 103

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:

SampleObserv1Observ2Observ3Observ4Observ5
1.25.006.992.641.40
2.13.005.572.361.11
3.23.006.812.611.36
4.27.007.162.681.43
5.87.009.703.111.94
6.34.007.662.771.53
7.36.007.782.791.56
8.24.006.902.631.38
914.0026.007.072.661.41
1017.0015.005.882.421.18
1111.0072.009.293.051.86
1211.0045.008.272.881.65
1314.0024.006.902.631.38
1414.0034.007.662.771.53
1513.0034.007.662.771.53
1612.0023.006.812.611.36
1712.0023.006.812.611.36
18.31.007.462.731.49
19.21.006.612.571.32
20.11.005.212.281.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;

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