New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Lilly1FAMU
Calcite | Level 5

I have to write a SAS code / proc freq for each question. I need help. Please. 

 

Here is the first question with the PROC code at the bottom: 

 

. Is there a statistical association between getting a flu shot and gender?

 

data sasuser.final_proj;
set sasuser.final_proj;
*KEEP SEXVAR GENHLTH PHYSHLTH MENTHLTH MEDCOST1 ASTHMA3 DIABAGE3 EDUCA __RFSMOK3 LCSNUMCG FLUSHOT7 __IMPRACE __RFBING5 __AGE80 __BMI5 BIRTHSEX _RACE;
*/HERE ARE MY RECODES FOR MISSING VALUES/;
if genhlth = 7 or genhlth = 9 then genhlth =.;
if PHYSHLTH = 77 or PHYSHLTH = 99 then PHYSHLTH =.;
if menthlth = 77 or menthlth = 99 then menthlth =.;
if medcost1 = 7 or medcost1 = 9 then medcost1 =.;
if asthma3 = 7 or asthma3 = 9 then asthma3 =.;
if diabage3 = 98 or diabage3 = 99 then diabage3 =.;
if educa = 9 then educa =.;
if __rfsmok3 = 9 then __rfsmok3 =.;
if lcsnumcg = 777 or lcsnumcg = 999 then lcsnumcg =.;
if flushot7 = 7 or flushot7 = 9 then flushot7 =.;
if __RFBING5 = 9 then __RFBING5 =.;
if birthsex = 7 or birthsex = 9 then birthsex =.;
if _race = 9 then _race =.;
Run;

proc contents data=sasuser.final_proj;
RUN;

proc format;
VALUE sexvar 1 = 'MALE' 2 = 'FEMALE';
VALUE genhlth 1 = 'EXCELLENT' 2 = 'VERY GOOD' 3 = 'GOOD' 4 = 'FAIR' 5 = 'POOR';
VALUE medcost 1 = 'Yes' 2 = 'No';
VALUE asthma 1 = 'Yes' 2 = 'No';
VALUE educa 1 = 'Never attended school or only kindergarten' 2 = 'Grades 1 through 8 (Elementary)' 3 = 'Grades 9 through 11 (Some High School)'
4 = 'Grade 12 or GED (High School Graduate)' 5 = 'College 1 year to 3 years (Some college or technical school)' 6 = 'College 4 years or more (College graduate)';
VALUE rfsmok 1 = 'No' 2 = 'Yes';
VALUE flushot 1 = 'Yes' 2 = 'No';
VALUE imprace 1 = 'WHITE, NON-HISPANIC' 2 = 'BLACK, NON-HISPANIC' 3 = 'ASIAN, NON-HISPANIC' 4 = 'AMERICAN INDIAN/ALASKAN NATIVE, NON-HISPANIC'
5 = 'HISPANIC' 6 = 'OTHER RACE, NON-HISPANIC';
VALUE RFBING 1 = 'No' 2 = 'Yes';
VALUE birthsex 1 = 'Male' 2 = 'Female';
VALUE race 1 = 'White only' 2 = 'Black only' 3 = 'American Indian or Alaskan Native only' 4 = 'Asian only' 5 = 'Native Hawaiian or other Pacific Islander only'
6 = 'Other race only' 7 = 'Multiracial' 8 = 'Hispanic';
Run;

proc freq data=sasuser.final_proj;
table flushot7 * sexvar /chisq;
format flushot7 flushot. sexvar sexvar.;
run;

 

 

 

 

3.Is the mean body mass index significantly different by race? Which race has the
highest bmi?

4. (15 points) Is there a significant association between binge drinking and race?
5. (5 points) what percentage of individuals are at or above 65 years of age?
6. (5 points) is there a significant correlation between body mass index and age?
7. (10 points) Is there an association between race and not having money for medical treatment?
8. (15 points) Is there a significant difference in mean days of poor mental health and gender?
9. (10 points) is there an association between having a flu shot and education? Which group has
the highest proportion of reported flu shots?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Most of us will not do your homework for you. However, if you try to write code for the other questions and it doesn't work, show us the code you have written for the other questions and people will be happy to help.

--
Paige Miller

View solution in original post

1 REPLY 1
PaigeMiller
Diamond | Level 26

Most of us will not do your homework for you. However, if you try to write code for the other questions and it doesn't work, show us the code you have written for the other questions and people will be happy to help.

--
Paige Miller

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 791 views
  • 1 like
  • 2 in conversation