-1
跟進到 SAS - transpose multiple variables in rows to columns設置名稱idgroup
我有以下代碼:
data have;
input CX_ID 1. TYPE $1. COUNT_RATE 1. SUM_RATE 2.;
datalines;
1A110
1B220
2A120
;
run;
proc summary data = have nway;
class cx_id;
output out=want (drop = _:)
idgroup(out[2] (count_rate sum_rate)= count sum);
run;
所以這個表:
CX_ID TYPE COUNT_RATE SUM_RATE
1 A 1 10
1 B 2 20
2 A 1 20
成爲
CX_ID COUNT_1 COUNT_2 SUM_1 SUM_2
1 1 2 10 20
2 1 . 20 .
瓦ich是完美的,但我如何設置名稱爲
Count_A Count_B Sum_A Sum_B
或者一般情況下,無論在有表的類型字段值?
謝謝
如果您將類從CX_ID更改爲您的類型,會發生什麼?或者在CLASS語句中? – Reeza
您發佈的代碼無效。 – Reeza
我需要Cx_ID的最終表格。這個想法是通過Cx_ID按類型在一行中計算產品代碼和費率總和。 – Ben