w****r 发帖数: 1046 | 1 IF THEN 不起作用, 还是2个test都做. Thanks!!!
OPTIONS MACROGEN;
%MACRO TWO_SAMPLE (IN=, Y=, A=, ALPHA=);
PROC UNIVARIATE DATA=&IN NORMAL NOPRINT;
BY &A; VAR &Y;
OUTPUT OUT=ONE MEAN=MEANY STD=STDY N=N PROBN=PNORMAL;
DATA TWO;SET ONE;
IF PNORMAL>0.05 THEN DO;
PROC TTEST DATA=∈
CLASS &A; VAR &Y;
ODS OUTPUT TTESTS=TT;
DATA TT;SET TT;
IF _N_=2;
KEEP PROBT;
RENAME PROBT=PROB;
DATA THREE;IF _N_=1 THEN SET TT;SET TWO;
END;
IF PNORMAL ne 0.05 THEN DO;
| g*g 发帖数: 1 | 2 %if %then %do......
【在 w****r 的大作中提到】![](/moin_static193/solenoid/img/up.png) : IF THEN 不起作用, 还是2个test都做. Thanks!!! : OPTIONS MACROGEN; : %MACRO TWO_SAMPLE (IN=, Y=, A=, ALPHA=); : PROC UNIVARIATE DATA=&IN NORMAL NOPRINT; : BY &A; VAR &Y; : OUTPUT OUT=ONE MEAN=MEANY STD=STDY N=N PROBN=PNORMAL; : DATA TWO;SET ONE; : IF PNORMAL>0.05 THEN DO; : PROC TTEST DATA=∈ : CLASS &A; VAR &Y;
| p********a 发帖数: 5352 | 3 修改了一下。你的CODE主要有几个问题
1. Data step and proc step 不能nested. Data step can't be nested in another
data step either.
2. %IF %THEN %END should be in open mode instead of data step
3. When you compare values in open mode, it has to be macro variables. (see
proc sql)
I still don't understand your last 4 data steps. There is no macro variables
at all. Why put them inside the macro.
OPTIONS MACROGEN;
%MACRO TWO_SAMPLE (IN=, Y=, A=, ALPHA=);
PROC UNIVARIATE DATA=&IN NORMAL NOPRINT;
BY &A; VAR &Y;
O | a**b 发帖数: 1198 | 4 there have a lot of problems in your code, you'd better find some sample
code for macro.
papertigra had told you the most problems | p********a 发帖数: 5352 | | w****r 发帖数: 1046 | 6 太感谢你们了
真是nice啊:)
【在 p********a 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 你先测试一下找错吧。如果有问题再POST
|
|