Learning SAS? Welcome to the exclusive online community for all SAS learners.

3-way cross-tabulations (chi-square tests)

Reply
New Contributor
Posts: 3

3-way cross-tabulations (chi-square tests)

I am trying to create a cross-tabulation table. 

tables (a b c)*d;

the code that i am using is:

proc surveyfreq= brfss15.datamake;

tables dispcode*sex*hlthpln1*cvd;

run;

 

I can't get this code to run, what am I doing wrong?I am trying to stratify by dispcode, sex, and hlthpln1 for cardiovascular disease.

 

 

Super User
Posts: 10,538

Re: 3-way cross-tabulations (chi-square tests)

Survey freq usually will want some sample design information and weighting variables. With BRFSS data you likely want a Cluster for the primary sample unit, which might be _psu and a Weight variable. Also since some of the data in BRFSS is missing because of skip patterns you may want the option NOMCAR on the proc statement. If you are not providing that information there is little reason to use surveyfreq.

 

With that in mind, can you post the log with the submitted code? "Can't get this code to run" sort of indicates there should be an error message in the log about what you submitted. Post the code portion and any messages in a code box using the forum {i} menu icon. Error messages sometimes have position indicators but the the message window in the forum reformats text and loses that position.

 

Also, which version of SAS are you running? There was problem with a couple releases where surveyfreq didn't like some compound table requests.

 

 

Trusted Advisor
Posts: 1,630

Re: 3-way cross-tabulations (chi-square tests)


agolden2410 wrote:

I am trying to create a cross-tabulation table. 

tables (a b c)*d;

the code that i am using is:

proc surveyfreq= brfss15.datamake;

tables dispcode*sex*hlthpln1*cvd;

run;

 

I can't get this code to run, what am I doing wrong?I am trying to stratify by dispcode, sex, and hlthpln1 for cardiovascular disease.

 

 


What happens when you try to run this code? Show us the SASLOG and any errors contained therein.

 

New Contributor
Posts: 3

Re: 3-way cross-tabulations (chi-square tests)

As soon as the code finishes running I will post the log. 

Super User
Posts: 9,687

Re: 3-way cross-tabulations (chi-square tests)

You have four dimensions ,

Could you try PROC CATMOD ?

Ask a Question
Discussion stats
  • 4 replies
  • 129 views
  • 0 likes
  • 4 in conversation