Does the following work? You may need to look at the log to see if you need to do a proc sort; by EMU; run; first of not.
Code:PROC MEANS DATA=gravitydata mean MAXDEC=2;VAR gdp1; by EMU;run;
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.
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?Code: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;
I know that I can use the PROC MEANS:
But this shows the mean for all the observation.Code:PROC MEANS DATA=gravitydata mean MAXDEC=2; VAR gdp1; run;
Thanks in advance.
Does the following work? You may need to look at the log to see if you need to do a proc sort; by EMU; run; first of not.
Code:PROC MEANS DATA=gravitydata mean MAXDEC=2;VAR gdp1; by EMU;run;
Stop cowardice, ban guns!
JoLinda91 (03-03-2016)
The BY statement will work when data is sorted; alternatively there is the CLASS statement, and you don't need to sort your data.
Code:PROC MEANS DATA=gravitydata mean MAXDEC=2; CLASS emu; *just add this; VAR gdp1; run;
All things are known because we want to believe in them.
JoLinda91 (03-03-2016)
Tweet |