Use ODS OUTPUT to get the table :
ods listing select none;
proc freq data=sashelp.heart;
table (status sex) * (chol_status bp_status weight_status) / chisq;
ods output ChiSq=outChiSq;
run;
ods listing;
proc sql;
create table myChiSq as
select
scan(Table,2) as v1 length=32,
scan(Table,3) as v2 length=32,
df,
value,
prob
from outChiSq
where statistic="Chi-Square"
order by v1, v2;
select * from myChiSq;
quit;
Note : You need parentheses around the variable lists in the TABLES statement.
Use ODS OUTPUT to get the table :
ods listing select none;
proc freq data=sashelp.heart;
table (status sex) * (chol_status bp_status weight_status) / chisq;
ods output ChiSq=outChiSq;
run;
ods listing;
proc sql;
create table myChiSq as
select
scan(Table,2) as v1 length=32,
scan(Table,3) as v2 length=32,
df,
value,
prob
from outChiSq
where statistic="Chi-Square"
order by v1, v2;
select * from myChiSq;
quit;
Note : You need parentheses around the variable lists in the TABLES statement.
This is great! Thank you so much!
You are welcome. Please mark answer as accepted solution.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.