libname mydata “/courses/u_coursera.org1/i_1006328/c_5333” access=readonly;

DATA new; set mydata.gapminder_pds;

/* POLITY is “Democracy minus Autocracy ranges from -10 to 10” */

/*POLITY RANGES FROM -10 TO 10, making groups */

/*SETTING -10 TO -8 as 0, -7 to -5 as 1

-4 to -2 as 2, -1 to 1 as 3, 2 to 4 as 4,

5 to 7 as 5, and 8 to 10 as 6 */

IF POLITYSCORE=-10 OR POLITYSCORE=-9 OR POLITYSCORE=-8 THEN POL=0;

ELSE IF POLITYSCORE=-7 OR POLITYSCORE=-6 OR POLITYSCORE=-5 THEN POL=1;

ELSE IF POLITYSCORE=-4 OR POLITYSCORE=-3 OR POLITYSCORE=-2 THEN POL=2;

ELSE IF POLITYSCORE=-1 OR POLITYSCORE=0 OR POLITYSCORE=1 THEN POL=3;

ELSE IF POLITYSCORE=2 OR POLITYSCORE=3 OR POLITYSCORE=4 THEN POL=4;

ELSE IF POLITYSCORE=5 OR POLITYSCORE=6 OR POLITYSCORE=7 THEN POL=5;

ELSE IF POLITYSCORE=8 OR POLITYSCORE=9 OR POLITYSCORE=10 THEN POL=6;

PROC SORT; by COUNTRY;

PROC ANOVA; CLASS POLITYSCORE;

MODEL ALCCONSUMPTION=POLITYSCORE;

MEANS POLITYSCORE/DUNCAN;

PROC ANOVA; CLASS POL;

MODEL ALCCONSUMPTION=POL;

MEANS POL/DUNCAN;

run;