Hey everyone,
I'm having difficulty getting my code to run proc freq with title statements. I initially had each table with its own proc freq statement but I condensed it to this, and it still seems to not work. No matter where I put the title, I get this error in my log: Statement is not valid or it is used out of proper order.
proc freq data=thesis.a;
title1="Table 1";
tables DataA*(Datab Datac Datad Datae Dataf)/chisq;
title2="Table 2";
table (rDatab Datac Datad Datae Dataf);
title3="Table 3";
tables DataA*(Datag Datah Datai Dataj Datak)/chisq;
title4="Table 4";
tables compfood*(DataL DataM DataN DataO DataP)/chisq;
run;
The correct syntax is
title1 "Table 1";
Note there is no equal sign.
Also, putting multiple title statements within one PROC will put all the titles (title1 through title4 in this case) above all of the tables. The only way to get separate titles over each table is to run multiple PROC FREQs each with its own title.
TITLE statements are global statemenst that are executed as soon as they are encountered during code fetch, so your code (title statements corrected) is equivalent to this:
title1 "Table 1";
title2 "Table 2";
title3 "Table 3";
title4 "Table 4";
proc freq data=thesis.a;
tables DataA*(Datab Datac Datad Datae Dataf)/chisq;
tables (rDatab Datac Datad Datae Dataf);
tables DataA*(Datag Datah Datai Dataj Datak)/chisq;
tables compfood*(DataL DataM DataN DataO DataP)/chisq;
run;
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.
Ready to level-up your skills? Choose your own adventure.