Объединение или объединение test1 и test2 по ИМЯ:
proc sort data=work.test1;
by name;
run;
proc sort data=work.test2;
by name;
run;
data work.test;
merge work.test1 work.test2;
by name;
run;
Создание этого результата:
Name Sex Age Height Weight female
Alfred M 14 69.0 112.5 0
Alice F 13 56.5 84.0 1
Barbara F 13 65.3 98.0 1
Carol F 14 62.8 102.5 1
Henry M 14 63.5 102.5 0
James M 12 57.3 83.0 0
Jane F 12 59.8 84.5 1
Janet F 15 62.5 112.5 1
Jeffrey M 13 62.5 84.0 0
John M 12 59.0 99.5 0
Joyce F 11 51.3 50.5 1
Judy F 14 64.3 90.0 1
Louise F 12 56.3 77.0 1
Mary F 15 66.5 112.0 1
Philip M 16 72.0 150.0 0
Robert M 12 64.8 128.0 0
Ronald M 15 67.0 133.0 0
Thomas M 11 57.5 85.0 0
William M 15 66.5 112.0 0
Запуск макроса с объединенным выводом:
%table_char(test, height weight age, sex, female, test_table_char);
Создает следующий результат:
categorical value
Sex
F 9(47.4%)
M 10(52.6%)
Height
Count(Missing) 19(0)
Mean (SD) 62.3(5.1)
Median (IQR) 62.8(57.5 - 66.5
Range 51.3 - 72.0
90th Percentile 69.0
Weight
Count(Missing) 19(0)
Mean (SD) 100.0(22.8)
Median (IQR) 99.5(84.0 - 112.
Range 50.5 - 150.0
90th Percentile 133.0
Age
Count(Missing) 19(0)
Mean (SD) 13.3(1.5)
Median (IQR) 13.0(12.0 - 15.0
Range 11.0 - 16.0
90th Percentile 15.0
Female 9(47.4%)