BookmarkSubscribeRSS Feed
Cindarellie
Calcite | Level 5

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;

2 REPLIES 2
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
Kurt_Bremser
Super User

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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 21226 views
  • 5 likes
  • 3 in conversation