Moderation
Moderation in The Context of Correlation
Now that I know how to take into account a third variable, a particular questions that I needed answer for was income level is somehow associated as a third variable on my previous analysis in discovering whether there is a relationship between drinking and gambling. For this I had to categorize the income level into 5 categories as follows:
7=less than or equal to 9,999;
15=10,000-19,999;
28=20,000-34,999;
45=35,000-59,999;
75=60,000-89,999;
105=90,000-119,999;
160=120,000+
For the purpose of this test I am going to run a CORRELATION COEFICIENT test on the 7 income categories that I have created.
The results show that for 2 the lowest income group, as I expected, does not show a significant value both in its correlation coefficient and its P-value. However, this relation gets really strong as the income level rises. So with this information we can safely conclude that income level has a significant impact as a moderator to determine the direction of the study, and define whether the person who had a lot drinks is also going to gamble or not. If they are on the upper levels of income group, they will, if they are not they won't.
-----------------------
Code Screenshot:
-----------------------
Code Text:
-----------------------
LIBNAME mydata "/courses/d1406ae5ba27fe300" access=readonly; DATA new; set mydata.nesarc_pds; LABEL S1Q11A="Total Family Income in Last 12 Months - Category" S2AQ7D="Number of Drinks of Liquor Consumed on Days When Drunk" S12Q1="Ever Gambled 5+ Times in Any One Year" DGSTATUS="Drug Use Status" S1Q6A="Highest Grade of Year of School Completed" SPOUSE="Respondent Has a Spouse" S3BQ1A9A="Ever Used Heroin" S3BD9Q2A="Age First Used Heroin" S3BD9Q2B="Used Heroin in Last 12 Months" NUMPERS="Number of Persons in Household" S3BD5Q2E="How Often Used Cannabis When Using the Most" S3BD9Q2C="How Often Used Heroin in Last 12 Months" S3BD9Q2E="How Often Used Heroin When Using the Most" AGEGROUP="Age First Used Heroin"; /* Just giving AGEGROUP a lable too */ IF S12Q1 LE 2; IF S3BQ1A9A=9 THEN S3BQ1A9A=.; IF S3BQ1A9A NE 9 AND S3BD9Q2B=. THEN S3BD9Q2B=11; IF S3BQ1A9A NE 9 AND S3BD9Q2A=. THEN S3BD9Q2A=99; /* Assiging 99 to avoide misrepresentation */ IF S3BD9Q2A NE 99 AND S3BD9Q2A LE 17 THEN AGEGROUP=1; /* Ages 17 and below as group 1*/ IF S3BD9Q2A NE 99 AND S3BD9Q2A GE 18 AND S3BD9Q2A LE 30 THEN AGEGROUP=2; /* Ages 18 - 29 as group 2 */ IF S3BD9Q2A NE 99 AND S3BD9Q2A GE 31 THEN AGEGROUP=3; /* Ages 30 and above as group 3 */ IF S3BQ1A9A NE 9 AND S3BD9Q2E=. THEN S3BD9Q2E=11; IF DGSTATUS LE 2; /* Retriving data only for current or ex- drug users */ IF AGE LE 45; /* Intrested in the age group of 45 and below */ IF S2AQ7D=99 THEN S2AQ7D=.; IF S3BD5Q2E=99 THEN S3BD5Q2E=.;
/*USINC: 7=less than or equal to 9,999; 15=10,000-19,999; 28=20,000-34,999; 45=35,000-59,999; 75=60,000-89,999; 105=90,000-119,999; 160=120,000+ */
IF S1Q11A LE 9999 THEN USINC =7; IF S1Q11A GE 10000 AND S1Q11A LE 19999 THEN USINC=15; IF S1Q11A GE 20000 AND S1Q11A LE 34999 THEN USINC=28; IF S1Q11A GE 35000 AND S1Q11A LE 59999 THEN USINC=45; IF S1Q11A GE 60000 AND S1Q11A LE 89999 THEN USINC=75; IF S1Q11A GE 90000 AND S1Q11A LE 119999 THEN USINC=105; IF S1Q11A GE 120000 THEN USINC=160; /* PROC SORT; by USINC;
PROC FREQ; TABLES S12Q1*S2AQ7D/CHISQ; BY USINC; */
PROC SORT; BY USINC; PROC CORR; VAR S12Q1 S2AQ7D; BY USINC;
RUN;











