Hello,
Using SAS 9.4
I have a couple questions about formatting and pvalue that I would like to ask.
1) How do I put a pvalue into a crosstabs tables?
2) Is their a way to remove the cumulative frequency and cumulative percent in the crosstabs (I am using list missing so the frequency and percent are the last 2 columns of the table) and put the pvalue in its place?
proc format;
value $Race 'C' = 'Caucasian'
'AA' = 'African American'
'A' = 'Asian'
'O', 'U'= 'Other/Unknown';
proc freq data = mylib.a (where=(Used_a_recommendation ne 'N/A'));
tables Used_a_recommendation*Race /list missing;
format Used_a_recommendation $Used_a_recommendation. Race $Race.;
title Table 8. Used a Recommendation crosstabs by Race;
run;
Thank you!
You can use the NOCUM option to suppress the cumulative counts and proportions, as follows:
proc freq data = sashelp.heart;
tables Weight_Status*Chol_Status /list missing nocum;
run;
You are not running any tests, so there are no p values. If you run a test such as the chi-square test, you will get one p-value for the whole table. That p-value and the associated statistics appear in a different table.
If you specify the statistical test that you want to run, we might be able to offer other suggestions.
1. Not easily, you can capture the ODS table and merge them together to get a chi square table.
2. You can add the nopercent, norow, nocol (check the docs on the table statement) to not include the percentages.
This statement is incorrect, it has no quotation marks.
title Table 8. Used a Recommendation crosstabs by Race;
This is more than you need, but an example of how it could be done.
https://gist.github.com/statgeek/b308ac2cfc9b4db0ee3d793567627af0
You can also search on lexjansen.com to find many examples of this type of reporting.
To use a capture the output approach, see the examples here on how to get the P-Value and then you can merge it in.
https://blogs.sas.com/content/iml/2017/01/09/ods-output-any-statistic.html
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.