0
votes

I'm new in SAS and I'm having problems to generate Pearson Chi-squared and p-value. I tried some tutorials and Youtube videos but I failed.

I`d like to use Proc Freq to generate a cross tabulation of the CO2_level and Yield_category variables. Also get the Pearson Chi-squared test statistic and p-value associated with this cross tabulation. However, when I run the code I get only the frequency as an output.

I have the following table

My code is:

proc freq data=growth;
    tables CO2_level*Yield_category/nopercent norow testp=(50 25 25);
run;

My result is the following table:

Can anyone help me to solve that?

Thanks,

Carlos

1
Sorry, the result table is wrong. Actually I`m getting only the frequency.Carlos Santiago
Please add images in the question body as images (or -even better - as text), not as links.M. Prokhorov

1 Answers

0
votes

Add the CHISQ option to the TABLES statement.

Please check the documentation in the future, in particular the examples section such as this, where you can find fully worked examples: http://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.2&docsetId=procstat&docsetTarget=procstat_freq_examples03.htm&locale=en

proc freq data=growth;
    tables CO2_level*Yield_category/nopercent norow testp=(50 25 25)  CHISQ;
run;