Action Principale : caEffect
| 1 | DATA mycas.causal_data; |
| 2 | call streaminit(123); |
| 3 | DO i = 1 to 100; |
| 4 | IF rand('UNIFORM') > 0.5 THEN treatment = 'A'; ELSE treatment = 'B'; |
| 5 | covar1 = rand('NORMAL', 5, 1); |
| 6 | covar2 = rand('UNIFORM') * 10; |
| 7 | IF treatment = 'A' THEN outcome = 10 + 2*covar1 + 0.5*covar2 + rand('NORMAL', 0, 2); |
| 8 | ELSE outcome = 15 - 1.5*covar1 + 1*covar2 + rand('NORMAL', 0, 2); |
| 9 | |
| 10 | /* Simular probabilidades de tratamiento y resultados predichos */ |
| 11 | prob_treat_A = 0.4 + 0.02 * covar1; |
| 12 | prob_treat_B = 1 - prob_treat_A; |
| 13 | pred_outcome_A = 10 + 2*covar1 + 0.5*covar2; |
| 14 | pred_outcome_B = 15 - 1.5*covar1 + 1*covar2; |
| 15 | OUTPUT; |
| 16 | END; |
| 17 | RUN; |