justifying font in columns

Reply
Frequent Contributor
Posts: 87

justifying font in columns

i need to justify aliment of the columns

data test;

input ID $ 1-5 NAME $ 6-17 REMARKS $ 18-35;

datalines;

1121 Tom Carry     Not attended demo

1122 Nancy Peter Out of town     

1123 Smith           attended demo   

1124 John perera   holiday on demo 

;

run;

proc report data=test nowd;

run;

as name and remarks are left aligned i want full justify alligment as shown

ID      Name           Remarks

1121 Tom    Carry  Not attended demo

1122 Nancy Peter Out      of        town     

1123 Smith           attended        demo   

1124 John perera   holiday   on   demo 

is it possible

Super User
Super User
Posts: 7,727

Re: justifying font in columns

Hi,

Read up on the proc report section as its quite big.  Something like:

proc report data=test nowd;

     define ID / "ID" style(column)=[j=c];

     define Name / "Name" style(header)=[j=r] style(column)=[j=r];

run;

Frequent Contributor
Posts: 87

Re: justifying font in columns

I am getting error any way

i dont want any thing right or center i want all columns to be justified as in word u have option justify

Super User
Super User
Posts: 7,727

Re: justifying font in columns

Please elaborate, what error are you getting?  The word is actually just= (not j=) with the options l=left, r=right, c=centered.

Do you mean centered, then change to just=c.

Super User
Posts: 9,878

Re: justifying font in columns

What destination are you using ? SAS has no such align style like word .

Here is an example for PDF destionation.

data have;
infile cards length=len;
input str $varying200. len;
cards;
China adheres to the principle
I can't abide to see
As the branch
Abide in Me, and I in you
;
run;
proc sql noprint;
select max(length(str)) into : max from have;
quit;
%put &max ;
data want(keep=str new_str);
 set have;
 length new_str $ 200 ;
 blanks=countc(strip(str),' ') + ( &max - length(str));
 c=countw(str,' ');
 l=int(divide(blanks,c-1));
 r=blanks-l*(c-1)+1;
 do i=1 to c;
  if i le r  then new_str=catx(repeat(' ',l),new_str,scan(str,i,' '));
   else new_str=catx(repeat(' ',l-1),new_str,scan(str,i,' '));
 end;
run;
ods listing close;
ods pdf file='c:\temp\x.pdf' ;
proc print noobs;run;
ods pdf close;
ods listing;


Xia Keshan

Ask a Question
Discussion stats
  • 4 replies
  • 291 views
  • 5 likes
  • 3 in conversation