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

Innovate_SAS_Blue.png

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. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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