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
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;
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
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.
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.