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;
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.