BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
willy0625
Calcite | Level 5

Hello SAS users. Below of an extract of what I am working at the moment.

data test;

      input score;

      cards;

      9125

      9455

      ;

run;

ODS RTF style=Journal BODYTITLE;

ODS NOPROCTITLE;

      PROC freq DATA=test;

            TABLES score / nocol norow nopercent;

      RUN;

ODS RTF CLOSE;

While I want to keep the Journal style, I would like to;

- be able to manipulate column width so that I get more spaced out table hence easier to read

- put a comma after every 3 digits for the score

- put a total row at the bottom

Anyone has an idea?

Many thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

I think Cynthia@sas can use proc template to tailor it .

But you can always use proc report to customize the output .

data test;
      input score;
      cards;
      9125
      9455
      ;
run;

ods output OneWayFreqs=x;
      PROC freq DATA=test ;
            TABLES score / nocol norow nopercent;
      RUN; 

ODS RTF style=Journal BODYTITLE;
ODS NOPROCTITLE;
title ' ';
proc report data=x(drop= f_:) out=p nowd;
 column table score frequency cumfrequency;
 define table/display  style={cellwidth=2cm} ' ';
 define score /analysis format=comma10. style={cellwidth=2cm};
 compute score;
 if _break_='_RBREAK_' then table='Total:';
  else call missing(table);
 endcomp;
 rbreak after /summarize ;
run;
ODS RTF CLOSE;

Ksharp

View solution in original post

2 REPLIES 2
Ksharp
Super User

I think Cynthia@sas can use proc template to tailor it .

But you can always use proc report to customize the output .

data test;
      input score;
      cards;
      9125
      9455
      ;
run;

ods output OneWayFreqs=x;
      PROC freq DATA=test ;
            TABLES score / nocol norow nopercent;
      RUN; 

ODS RTF style=Journal BODYTITLE;
ODS NOPROCTITLE;
title ' ';
proc report data=x(drop= f_:) out=p nowd;
 column table score frequency cumfrequency;
 define table/display  style={cellwidth=2cm} ' ';
 define score /analysis format=comma10. style={cellwidth=2cm};
 compute score;
 if _break_='_RBREAK_' then table='Total:';
  else call missing(table);
 endcomp;
 rbreak after /summarize ;
run;
ODS RTF CLOSE;

Ksharp

art297
Opal | Level 21

Take a look at: http://support.sas.com/resources/papers/freq92.pdf

It has a number of examples regarding how to change the appearance of proc freq output.

hackathon24-white-horiz.png

Join the 2025 SAS Hackathon!

Calling all data scientists and open-source enthusiasts! Want to solve real problems that impact your company or the world? Register to hack by August 31st!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 3160 views
  • 3 likes
  • 3 in conversation