To assign the desired number of observations to each subgroup, as shown Figure 1, part of the %Ratio module must be modified.

For sample size, nk, observation values of the kth subgroup are extracted from a randomly generated U(ak, bk). U1 corresponds to the lowest interval subgroup, and U2 corresponds to the next lowest interval subgroup. For example, the minimum value, maximum value and number of subgroups are set to 1, 21 and 5, respectively. Therefore, the subgroups are (1, 5), (5, 9), (9, 13), (13, 17), (17, 21). The subgroups are assigned frequencies of 0.55, 0.05, 0.2, 0.15 and 0.05, respectively. &NSP denotes the total sample size; ID is the observation identification.

%MACRO RATIO;

IF 1=< ID <&NSP.*0.55 THEN _H1=U1;

ELSE IF &NSP.*0.55 =

ELSE IF &NSP.*0.6 =< ID <&NSP.*0.8 THEN _H1=U3;

ELSE IF &NSP.*0.8 =< ID <&NSP.*0.95 THEN _H1=U4;

ELSE _H1=U5;

%MEND RATIO;

If model includes discrete variables, then specify the model in part of PROC LOGISTIC in %MODEL_CATEGORICAL, and ensure the input parameter R is greater than 1.

%MACRO MODEL_CATEGORICAL;

ODS OUTPUT PARAMETERESTIMATES=PARAM_&R CONVERGENCESTATUS=STATUS_&R TYPE3=TYPE3_&R;

PROC LOGISTIC DATA=G&R;

/*******modification**********************/

CLASS C1(PARAM=REF REF="0") D1(PARAM=REF REF="0") ;

MODEL Y(EVENT='1')= C1 X1 X2 X3 D1

/*********************************/

/TECH=NR MAXITER=8 XCONV=0.01;

BY STRATA; RUN;

%MEND;