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
Rhodochrosite | Level 12

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
Rhodochrosite | Level 12

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
Rhodochrosite | Level 12

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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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