Hi,
I have data for 2 different years - 2008 and 2016 - on whether people living in a particular community use different substances such as alcohol, tobacco etc (yes/no variable coded as 0=No, 1=Yes).
Have (raw data):
data WORK.RAW_DATA(label='raw_data dataset written by Stat/Transfer Ver. 11.2.2106.0521 ');
infile datalines dsd truncover;
input Community_name:$1. Year:32. Alcohol_use:32. Tobacco_use:32. Marijuana_use:32.;
datalines4;
A,2008,1,1,0
A,2008,1,1,1
A,2008,1,0,1
A,2008,1,1,1
A,2008,1,1,1
A,2008,0,0,1
A,2008,0,0,1
A,2008,1,0,0
A,2008,0,1,0
A,2008,1,1,1
A,2008,0,0,1
A,2008,0,1,1
A,2008,0,1,1
A,2008,0,0,0
A,2008,1,1,1
A,2008,1,1,0
A,2008,1,1,1
A,2008,0,0,0
A,2008,0,1,1
A,2008,1,1,1
A,2016,1,0,0
A,2016,1,0,1
A,2016,0,0,0
A,2016,0,0,0
A,2016,1,1,0
A,2016,1,1,1
A,2016,1,1,1
A,2016,0,0,0
A,2016,0,0,0
A,2016,0,1,0
A,2016,0,0,1
A,2016,1,1,1
A,2016,0,1,1
A,2016,0,1,1
A,2016,0,0,0
A,2016,1,1,1
A,2016,0,0,0
A,2016,1,1,1
A,2016,0,0,0
A,2016,1,1,1
A,2016,1,0,1
A,2016,0,1,0
A,2016,0,0,0
A,2016,0,0,0
A,2016,0,1,0
;;;;
I am using chi-square to analyze the data for each community using the following code in SAS 9.4:
proc freq data=raw_data;
table year * alcohol_use year*tobacco_use year*marijuana_use/ nopercent nocolumn chisq;
run;
The results are attached.
I am interested in the freq count and row percentages for the yes responses coded "1" in 2008 and 2016, and predicted probability of chi-square value (highlighted in the resutls). Is there a way to export just the highlighted results to an excel file instead of having to manually enter the numbers or copy/paste for all the outcomes?
Want (summary statistics):
Outcome
2008count
2008percent
2016count
2016percent
prob
Alcohol_use
12
57.14
10
40.00
0.2463
Tobacco_use
14
66.67
12
48.00
0.2033
Marijuana_use
15
71.43
11
44.00
0.0616
Any suggestions?
Thank you.
... View more