BookmarkSubscribeRSS Feed
zimcom
Pyrite | Level 9

Hi Community,

 

I am using proc freq and proc means imbedded inside ods to generate reports with tables, I am encountered a few issues which I cannot find answers quickly on internet.

 

1. The table generated from proc freq and proc means are always "Left" aligned on the page, how can I make the table aligned to the center 

dm.JPG

2. I use the titles to generate the title for the report,

title2 bold h=12pt f='Calibri' color=black justify=c "- Statistical Review -";
title3 bold h=12pt f='Calibri' color=black justify=c " - Demographics -";

but I need to have each page (or each table generated by proc freq and proc means) has its own title, I don't know if there is a way to create a sub-title for each table or page of the report.

 

3. How can I format the decimal created by proc means 

Analysis Variable : age

N

Median

Minimum

Maximum

Lower Quartile

Upper Quartile

Range

608

70.0000000

18.0000000

103.0000000

60.0000000

79.0000000

85.0000000

 

Thank you very much as always

5 REPLIES 5
Reeza
Super User
#1 That's actually default behaviour from what I can see - the entering. Have you changed any settings? Which ODS destination are you using?

#3 - MAXDEC is your option, otherwise use PROC TABULATE where you can assign formats specifically.

#2 Title statements should work like this by default. Not sure what you mean about each page, is this when the table takes more than one page?

SuzanneDorinski
Lapis Lazuli | Level 10

Try the CENTER option to center the tables on the page. 

 

options center nodate;

ods noptitle;

ODS RTF FILE='/folders/myfolders/RTF/FREQ and MEANS output.rtf'
  STYLE=Pearl;
  
ODS PDF FILE='/folders/myfolders/RTF/FREQ and MEANS output.pdf';
  
proc freq data=sashelp.class;
  tables _all_ / list missing;
  title j=c "- Statistical Review -";
  title2 j=c "- Demographics -";
run;

proc means data=sashelp.class n median min max p25 p75 range maxdec=1;
  var age;
run;

ODS RTF CLOSE;

ODS PDF CLOSE;
zimcom
Pyrite | Level 9

@Reeza Thank you for your help as always!

@SuzanneDorinski Thank you very much

 

The decimal and centered the table works now.

 

Below is what I want for the subtitle, since each proc function ended on each page, I want the title for the page (or for the specific table generated by the proc function, as illustrated in italic below) 

 

options center nodate;
options orientation=landscape nonumber topmargin=".2in" bottommargin=".2in" leftmargin=".2in" rightmargin=".2in";
ods pdf file="C:\Documents\Statistical.pdf" style=Styles.Minimal;
title1 bold h=12pt f='Calibri' color=black justify=c " - Statistical Review -";

proc means data = dm1 n median min max q1 q3 Range maxdec=2;
var age;
* I want a subtitle for the table generated by this proc means function, like "- Age -";

* I also want to add a footnote to " *Note: patient's age was calculated using the mid of the month as their birthday";
run;


proc freq data = dm1;
tables sex race Stroke_on_awakening/nocum;

* I want a subtitle for report generated by this proc freq, like "- Subject Baseline Characteristics -";
run;

 

proc means data = ec1 n mean std min max q1 q3 Range maxdec=2;
var Administered_Drug_Volume;

* I want a subtitle for report generated by this proc freq, like "- Drug Administered -";
run;

 

proc freq data = evt1;
tables Type_of_anesthesia/nocum;

* I want a subtitle for report generated by this proc freq;
run;

 

footnote1 j=l "XXX Inc.";
footnote2 j=l "Data cutoff date: 15-Nov-2018";
footnote3 c=l "--- Confidential ---";
run;
ods _all_ close;
quit;

zimcom
Pyrite | Level 9

 

Please see the example above.

I have imbedded a few proc freq and proc means in ods, since each proc freq and proc means ends having the result table showing as one page, I want to have a subtitle for each of proc freq and proc means, and also on a few pages, I also need to make a footnote, 

 

Can anyone help me with the questions above?

Thank you so much

Reeza
Super User
Those should just be title and footnote statements. Remember to clear them after the proc so they don't carry over to other procedures. Change your comments to title and footnotes and see where that gets you. Note that with different ODS the titles/footnotes can end up in header so you may need to use an Embedded option depending on your destination.I don't believe that's an issue with PDF though.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 5 replies
  • 1675 views
  • 0 likes
  • 3 in conversation