turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- frequency tables and ChiSqu

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-13-2017 03:03 AM

Among a population, I want to see if there is a significant relationship between being SMI and receiving MHcare using frequency tables and ChiSqu, and there was.

PROC FREQ; table MentalSer*SMI/ chisq or; RUN;

****Now I want to further investigate to see if there is a relationship between income and those who received MHcare among those who said "yes" to SMI. How do I conduct a frequency table, ChiSqu Odd Ratio? Should I use a control statement? If so, how?

Also, when to us Odd Ratio or Relrisk?

PROC FREQ; TABLES SMI * MentalSer / chisq relrisk; RUN;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-13-2017 10:33 AM

One way to get analysis for each level of a variable is to use a BY statement, which would require sorting the data by any variables on the by stateement.

PROC FREQ;

by smi;

TABLES income* MentalSer / chisq relrisk;

RUN;

Or

PROC FREQ;

TABLES smi*income* MentalSer / chisq relrisk;

RUN; Which produce a separate table for each smi level.

If you are only interested in one specific level you can use

PROC FREQ;

where smi='Yes'; /* <= the value has to be actual values of the variable */

TABLES income* MentalSer / chisq relrisk;

RUN;

The approach you take would depend on what you are doing over all. Proc Freq can have multiple TABLES statements each with separate options. you could get both analysis with

Proc freq;

tables MentalSer*SMI/ chisq or;

tables smi*MentalSer*income/ chisq relrisk;

run;

The BY and WHERE would restrict analysis for all records where the separate tables statments would use all records.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-18-2017 03:21 PM

Those codes worked. :-)

Thank you for your help.