0
votes

I have created a dummy variable in SAS, that in any given year takes the value 1 if both countries are members of the EMU and 0 otherwise in that year.

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;

Now I want to see the mean for the variable gdp1 for countries which takes the value emu=0 and for countries which takes the value emu=1, respectively. How do I do that?

I know that I can use the PROC MEANS:

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

But this shows the mean for all the observation.

Thanks in advance.

1

1 Answers

2
votes

Just add a class statement, this groups by the specified variable.

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