I was trying to obtain pvalue using proc freq. But, looks like there are no cross tabulations. Is there any other alternative to obtain the p-values for these variable?
proc freq data = test2; 2082 tables non_femaleacademicprod * male_parent_aca_pro/ chisq; 2083 ods output ChiSq = chsq9(where=(Statistic = "Mantel-Haenszel 2083 ! Chi-Square")); 2084 run; WARNING: Output 'ChiSq' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used.
Here is some code that works. I used a WEIGHT variable so that I would not need to type some many rows of data. I also used 4 categories instead of 5.
data Test2; input non_femaleacademicprod male_parent_aca_pro Count; datalines; 1 1 27 1 2 13 1 3 23 1 4 33 2 1 37 2 2 23 2 3 13 2 4 15 3 1 14 3 2 9 3 3 5 3 4 7 4 1 14 4 2 9 4 3 5 4 4 12 ; ods trace on; proc freq data = test2; weight Count; tables non_femaleacademicprod * male_parent_aca_pro/ chisq; ods output ChiSq = chsq9(where=(Statistic="Mantel-Haenszel Chi-Square")); run;
proc print data=Chsq9;
Since my code works and yours does not, I suspect you might have a typo in the WHERE clause. First, output the entire data set of statistics by using
ods output ChiSq = chsq9;
Do you see the data? If so, it is your WHERE clause that is incorrect. Make sure there are no extra spaces. If necessary, use a simpler WHERE clause such as
ods output ChiSq = chsq9(where=(Statistic contains "Mantel"));
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.