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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.