Using SAS 9.4 2. (Summarizing categorical data) In this problem, you need to use
ID: 3294367 • Letter: U
Question
Using SAS 9.4
2. (Summarizing categorical data) In this problem, you need to use the SAS dataset alcohol.sas7bat to answer the following questions. Download the dataset and store it in the same folder (X:/STAT/SAS library/MyLibrary2). Dataset alcohol.sas7bat contains four variables ADULTS, KIDS, INCOME and CONSUME. ADULTS is the number of adults in a family, KIDS is the number of children in a family and INCOME is the income of a family. CONSUME = 1 if the family consumes alcohol, otherwise CONSUME = 0.
(a) Give the two-way contingency table of variables KIDS and CONSUME.
(b) Based on the output above, answer the following questions:
1. How many observations are there in this dataset?
2. What is the number of family that has at least 3 kids?
3. What is the percentage of family that consumes alcohol? 4. Among the family that has 4 kids, what is the percentage of family that consumes alcohol?
Explanation / Answer
Please see the attached sas code
libname lib 'C:UsersshashankDesktopSAS Data';
proc import datafile = 'C:UsersshashankDesktopSAS Datalcohol'
out= lib.alcohol
dbms= csv
replace;
getnames= yes;
run;
proc freq data= lib.alcohol ;
tables kids*consume;
run;
The results are
The SAS System 09:59 Saturday, August 7, 2017 1
The FREQ Procedure
Table of KIDS by CONSUME
KIDS(number of children in household)
CONSUME(=1 if consume alcohol, =0 otherwise)
Frequency‚
Percent ‚
Row Pct ‚
Col Pct ‚ 0‚ 1‚ Total
ƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ
0 ‚ 155 ‚ 471 ‚ 626
‚ 15.50 ‚ 47.10 ‚ 62.60
‚ 24.76 ‚ 75.24 ‚
‚ 66.24 ‚ 61.49 ‚
ƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ
1 ‚ 28 ‚ 105 ‚ 133
‚ 2.80 ‚ 10.50 ‚ 13.30
‚ 21.05 ‚ 78.95 ‚
‚ 11.97 ‚ 13.71 ‚
ƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ
2 ‚ 34 ‚ 124 ‚ 158
‚ 3.40 ‚ 12.40 ‚ 15.80
‚ 21.52 ‚ 78.48 ‚
‚ 14.53 ‚ 16.19 ‚
ƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ
3 ‚ 12 ‚ 49 ‚ 61
‚ 1.20 ‚ 4.90 ‚ 6.10
‚ 19.67 ‚ 80.33 ‚
‚ 5.13 ‚ 6.40 ‚
ƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ
4 ‚ 5 ‚ 15 ‚ 20
‚ 0.50 ‚ 1.50 ‚ 2.00
‚ 25.00 ‚ 75.00 ‚
‚ 2.14 ‚ 1.96 ‚
ƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ
5 ‚ 0 ‚ 2 ‚ 2
‚ 0.00 ‚ 0.20 ‚ 0.20
‚ 0.00 ‚ 100.00 ‚
‚ 0.00 ‚ 0.26 ‚
ƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ
Total 234 766 1000
23.40 76.60 100.00
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.