Dear, I neeed to calculate number of subjects by different sort order to calculate percentages. I am running following codes to calculate the NS and then merge with main data set by the sort order. It will be a 4 steps and I have to calcualte many. So I want tto know if I can do in one step. Please suggest help. Thanks. proc sql; create table NS1 as select count(distinct id) as NS1,trt1 from data1 group by trt1; quit; proc sql; create table NS2 as select count(distinct id) as NS2,term,trt1,period from adae3 group by period,trt1,term; quit; data1; id term trt1 period 1 ge 100 mg 1 2 ge 200 mg 1 3 ge 100 mg 1 4 ge 200 mg 1 5 ae 100 mg 1 6 ae 300 mg 1 output needed: data1; id term trt1 period ns1 ns2 1 ge 100 mg 1 3 2 2 ge 200 mg 1 2 2 3 ge 100 mg 1 3 2 4 ge 200 mg 1 2 2 5 ae 100 mg 1 3 1 6 ae 300 mg 1 1 1
... View more