p*****o 发帖数: 543 | 1 比如:
PROC REG;
IF A=1 THEN MODEL C=B;
IF A=0 THEN MODEL C=B D;
RUN;
试了一下,好像不可以啊,那有没有办法可以解决这个问题么?
非常感谢 |
s**c 发帖数: 1247 | 2 用macro吧
【在 p*****o 的大作中提到】 : 比如: : PROC REG; : IF A=1 THEN MODEL C=B; : IF A=0 THEN MODEL C=B D; : RUN; : 试了一下,好像不可以啊,那有没有办法可以解决这个问题么? : 非常感谢
|
p*****o 发帖数: 543 | 3 忘记说了,我这个PROC REG其实是在一个大的MACRO中的。是不是应该在PROC外围用%DO
%WHILE来解决啊 |
a********l 发帖数: 40 | 4 why not use proc glm
class |
A*******s 发帖数: 3942 | 5 这个A是variable么?
如果是的话,创建一个E,和A刚好相反,E=1 when A=0, E=0 when A=1
model C=B E*D
【在 p*****o 的大作中提到】 : 比如: : PROC REG; : IF A=1 THEN MODEL C=B; : IF A=0 THEN MODEL C=B D; : RUN; : 试了一下,好像不可以啊,那有没有办法可以解决这个问题么? : 非常感谢
|
D******n 发帖数: 2836 | 6 what is A? it doesnt look like a macro variable, then the question is what d
o u exactly want to do?
【在 p*****o 的大作中提到】 : 比如: : PROC REG; : IF A=1 THEN MODEL C=B; : IF A=0 THEN MODEL C=B D; : RUN; : 试了一下,好像不可以啊,那有没有办法可以解决这个问题么? : 非常感谢
|
p*****o 发帖数: 543 | 7 A is a macro variable....I just wanna put a indicator as A. Since we are not
sure whether we are going to use the first model or the second one. And I
wanna make it flexible in future by adding A as a macro variable.
So once I put A = 1 in future, it will use the 1st model and if I put A=0,
it will use the 2nd model...
d
【在 D******n 的大作中提到】 : what is A? it doesnt look like a macro variable, then the question is what d : o u exactly want to do?
|
p*****o 发帖数: 543 | 8 btw, what i want to know is that whether it is possible to use if statement
in Proc Reg.
just by saying the problem itself, i think there are a lot of substitute
ways to do it. |
s*r 发帖数: 2757 | 9 if might be used for data subsetting |
s*******f 发帖数: 148 | 10 I think IF,THEN statement is only valid in DATA step.
It won't take effect in any PROC steps.
You may refer to SAS help document for confirmation.
statement
【在 p*****o 的大作中提到】 : btw, what i want to know is that whether it is possible to use if statement : in Proc Reg. : just by saying the problem itself, i think there are a lot of substitute : ways to do it.
|
|
|
s*r 发帖数: 2757 | 11 ok only where can be used
【在 s*r 的大作中提到】 : if might be used for data subsetting
|
o****o 发帖数: 8077 | 12 'if then' programming statements are valid in many PROCs, such as PHREG,
NLMIXED, NLIN, to name a few
【在 s*******f 的大作中提到】 : I think IF,THEN statement is only valid in DATA step. : It won't take effect in any PROC steps. : You may refer to SAS help document for confirmation. : : statement
|
s*******f 发帖数: 148 | 13 oh really? Then sorry to louzhu for the wrong information@@
coz in the help document of IF-THEN/ELSE statement, it says "Valid: in DATA
step", so I thought it was only valid in DATA. Maybe I got it wrong@@
Anyway, thanks a lot for pointing out:)
【在 o****o 的大作中提到】 : 'if then' programming statements are valid in many PROCs, such as PHREG, : NLMIXED, NLIN, to name a few
|
o****o 发帖数: 8077 | 14 any PROC that supports user defined likelihood function or there is a page
of 'PROGRAMMING STATEMENT' in Detail section would support complex logic
programming
DATA
【在 s*******f 的大作中提到】 : oh really? Then sorry to louzhu for the wrong information@@ : coz in the help document of IF-THEN/ELSE statement, it says "Valid: in DATA : step", so I thought it was only valid in DATA. Maybe I got it wrong@@ : Anyway, thanks a lot for pointing out:)
|
s*r 发帖数: 2757 | |
p*****o 发帖数: 543 | 16 thank you guys for all the shared information |