【发布时间】:2015-04-10 10:05:31
【问题描述】:
我在 SAS 中创建了一个虚拟变量,如果两国都是 EMU 成员,则在任何给定年份取值 1,否则在该年取值 0。
emu1=0;
if country1 in ("AUT","BEL","FIN","FRA","DEU","IRL","ITA","NLD","PRT","ESP") and year>1998 then emu1=1;
if country1 in ("GRC") and year>2000 then emu1=1;
emu2=0;
if country2 in ("AUT","BEL","FIN","FRA","DEU","IRL","ITA","NLD","PRT","ESP") and year>1998 then emu2=1;
if country2 in ("GRC") and year>2000 then emu2=1;
emu=0;
if emu1=1 and emu2=1 then emu=1;
现在我想分别查看取值为 emu=0 的国家和取值为 emu=1 的国家的变量 gdp1 的平均值。我该怎么做?
我知道我可以使用 PROC MEANS:
PROC MEANS DATA=gravitydata mean MAXDEC=2;
VAR gdp1;
run;
但这显示了所有观察的平均值。
提前致谢。
【问题讨论】: