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;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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