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

I'd like to use proc means' output directly as a PDF file. For more visually appealing purpose, I wonder if i could left align the column label and the title in the final output as shown in image WANT below?  

 

SAS forum.png

 

proc means data=have stackods n maxdec=0;
    class fac; 
    var a1-a17;
    ods output summary=result(drop=NObs _control_ where=(N ne 0));
run;

proc print data=result label noobs;
    label variable='Birth Defect Types';
	label n='Total number of defects';
	label op_fac_name='Facility name';
	format variable $group.;
	title "FIRST INCIDENCE";
run;

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenKuhfeld
Ammonite | Level 13

There is a style option in proc print.  More generally, you can change the justification in the table template.

proc means data=sashelp.class stackods n maxdec=0;
    class sex; 
    var _numeric_;
	ods output summary=result(drop=NObs _control_ where=(N ne 0));
run;


proc print data=result label noobs style(header)={just=l};
    label variable='Birth Defect Types';
	label n='Total number of defects';
	label op_fac_name='Facility name';
	* format variable $group.;
	title "FIRST INCIDENCE";
run;

View solution in original post

4 REPLIES 4
WarrenKuhfeld
Ammonite | Level 13

There is a style option in proc print.  More generally, you can change the justification in the table template.

proc means data=sashelp.class stackods n maxdec=0;
    class sex; 
    var _numeric_;
	ods output summary=result(drop=NObs _control_ where=(N ne 0));
run;


proc print data=result label noobs style(header)={just=l};
    label variable='Birth Defect Types';
	label n='Total number of defects';
	label op_fac_name='Facility name';
	* format variable $group.;
	title "FIRST INCIDENCE";
run;
Cruise
Ammonite | Level 13

Great ways to align the labels. Thank you. Do you know why "by descending" in proc sort has no effect in the proc sort? Does proc print "style" options override previous options set forth?

 

 

proc means data=have stackods n maxdec=0;
    class op_fac_name; 
    var a1-a17;
    ods output summary=fac_types(drop=NObs _control_ where=(N ne 0));
run;

proc sort data=fac_types;
    by descending op_fac_name n;
run;

proc print data=fac_types label noobs style(header)={just=l};
    label variable='Defect Types';
	label n='Total number of defects';
	label op_fac_name='Facility name';
	format variable $group.;
	title "FIRST INCIDENCE";
run;

 

WarrenKuhfeld
Ammonite | Level 13

Descending certainly works.  Here is an example.

 

proc sort data=sashelp.class out=c1;
   by descending sex;
   run;
proc print; run;
proc sort data=sashelp.class out=c2;
   by descending sex descending height;
   run;
proc print; run;
ballardw
Super User

Another option may be to set column widths so you don't have to deal with the offest on the second line of a column heading at all.

Below is syntax example and may not have optimal widths due to your current style but should be easy to adjust.

 

proc print data=result label noobs style(header)={just=l};
   var op_fac_name / style=[width=1.25in];
   var variable   / style=[width=1.5in];
   var n   / style=[width=1.75in];
   label variable='Birth Defect Types';
	label n='Total number of defects';
	label op_fac_name='Facility name';
	* format variable $group.;
	title "FIRST INCIDENCE";
run;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 3269 views
  • 3 likes
  • 3 in conversation