Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Variables SAS中虚拟变量的PROC平均值_Variables_Sas_Mean_Proc - Fatal编程技术网

Variables SAS中虚拟变量的PROC平均值

Variables SAS中虚拟变量的PROC平均值,variables,sas,mean,proc,Variables,Sas,Mean,Proc,我在SAS中创建了一个虚拟变量,如果两个国家都是欧洲货币联盟成员国,则在任何给定年份取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

我在SAS中创建了一个虚拟变量,如果两个国家都是欧洲货币联盟成员国,则在任何给定年份取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方法:

PROC MEANS DATA=gravitydata mean MAXDEC=2;
VAR gdp1;
run;
但这显示了所有观察的平均值


提前感谢。

只需添加一个
class
语句,即可按指定变量分组

PROC MEANS DATA=gravitydata mean MAXDEC=2;
CLASS emu;
VAR gdp1;
run;

我试过了,但我发现了以下错误:
507proc意味着DATA=gravitydata意味着MAXDEC=2;508级动车组;错误:找不到变量EMU。509var-gdp1;510跑当您创建EMU变量时,您将数据集称为什么?啊,谢谢。我忘记了更改数据。现在很好用。谢谢!即使没有看到Keith的代码,也能进行惊人的调试:)