Hi:
With PROC REPORT, you can not use a LINE statement conditionally. That means you have to make a temporary variable with the value of the line for each condition and then you ALWAYS write out the temporary variable. The program below is a variation of your logic: [pre]
ods listing;
ods html file='c:\temp\cond_line.html' style=sasweb;
ods pdf file='c:\temp\cond_line.pdf';
ods rtf file='c:\temp\cond_line.rtf';
proc report data=sashelp.shoes nowd
style(lines)={just=l};
title "A conditional LINE statement";
column region product sales;
where product in ('Sandal', 'Slipper') and
region in ('Asia', 'United States', 'Pacific');
define region / group;
define product / group;
define sales/ sum f=dollar14.;
break after region /summarize skip;
COMPUTE AFTER region;
holdline = repeat(' ',100);;
holdsale = trim(left(put(sales.sum,dollar14.)));
if sales.sum lt 400000 then
holdline = 'LT: iiiii lllll jjjjj ' ||holdsale;
else if sales.sum ge 400000 then
holdline = 'GE: wwwww xxxxx yyyyy ' ||holdsale;
LINE holdline $100.;
ENDCOMP;
run;
ods _all_ close;
[/pre]
In the listing window, the output looks like this:
[pre]
A conditional LINE statement
Region Product Total Sales
Asia Sandal $8,208
Slipper $152,032
Asia $160,240
LT: iiiii lllll jjjjj $160,240
Pacific Sandal $48,424
Slipper $390,740
Pacific $439,164
GE: wwwww xxxxx yyyyy $439,164
United States Sandal $12,039
Slipper $967,927
United States $979,966
GE: wwwww xxxxx yyyyy $979,966
[/pre]
Which DOES get you the conditional line information. Note, how in the LISTING window, the letter 'i' is lined up with the letter 'w' -- the same results would have been achieved if I had used the '@' method. However, when the output is sent to RTF, PDF or HTML, the '@' in the LINE statement WILL NOT work. The reason it will not work is the same reason that the 'i' is NOT lined up with the 'w' in RTF, PDF and HTML output -- because ODS uses a proportional spaced font and so @13 on one line will be different than @13 on a second line, depending on what you've already written to the line.
When I explained in previous posts that the PUT statement did not work with ODS in the same way that it worked in the LISTING window, that same explanation also applies to the LINE statement. There is no good way to get the "exact" alignment that you want except in the LISTING window.
This means that you will have to write your output to the LISTING destination in order to get "exact" alignment and then use some other means (not ODS) to create a PDF file (such as a 3rd party Text-to-PDF converter).
Good luck!
cynthia