BookmarkSubscribeRSS Feed
newbi
SAS Employee
Line statement only has option to align- Right, Left or Center. Total doesn't line up for each sales rep.
Cynthia_sas
SAS Super FREQ
Hi:
Yes, I mentioned that in one of my previous posts -- when I said:
[pre]
"The LINE statement will do what you want (to write extra summary lines), but if your output is going to HTML, RTF or PDF output, there is
no guarantee that the LINE statement "extra" information will line up underneath the SALES column the way you want. (only in the LISTING
destination -- can you position your text strings written with the LINE statement. With other ODS destinations, your choices are to
LEFT, CENTER or RIGHT justify the LINE text strings.)"
[/pre]

That is why I recommended the other method. creating "dummy" or "extra" break variables -- which gives you the chance to place a value into a summary line, where it will line up with the other row values.

cynthia
Ksharp
Super User
No . I do not think so. You can work around it. You just need to pad some blank to line up above cells.I will give you an example .This example is lined up very well in my sas.try to run it.



[pre]
data test;
input patient sex $ Diabetes ;
cards;
1 M 1
2 M .
3 M 1
4 M 1
5 M 2
6 M 1
7 F .
8 F 2
9 F 2
10 F 2
11 F 1
12 F .
;
run;

proc format;
value diabetes
.='Unknown'
1='Diabetic'
2='Non-diabetic'

;
run;
ods pdf file='c:\x.pdf' style=sasweb;
proc report data=test nowd completerows out=see;
column diabetes sex,(n percent);
define diabetes /group format=diabetes. preloadfmt exclusive missing order=internal;
define sex /across;
define percent/'ColPctN' computed format=percent8.;
compute before;
sum1=_c2_ ;
sum2=_c4_;
endcomp;
compute percent;
if missing(diabetes) then do;
_sum1=sum1-_c2_;
_sum2=sum2-_c4_;
end;
else do;
_c3_=_c2_/_sum1;
_c5_=_c4_/_sum2;
end;
endcomp;
compute after /style={just=right asis=on};
str=cat('All : ',sum1,' 100% ',sum2,' 100%');
line str $200.;
endcomp;
run;
ods pdf close;
[/pre]




Ksharp
Ksharp
Super User
Actuall ,There is one more way.
[pre]
data test;
input patient sex $ Diabetes ;
cards;
1 M 1
2 M .
3 M 1
4 M 1
5 M 2
6 M 1
7 F .
8 F 2
9 F 2
10 F 2
11 F 1
12 F .
;
run;

proc format;
value diabetes
.='Unknown'
1='Diabetic'
2='Non-diabetic'

;
run;
ods pdf file='c:\x.pdf' style=sasweb;
proc report data=test nowd completerows out=see;
column diabetes sex,(n percent);
define diabetes /group format=diabetes. preloadfmt exclusive missing order=internal;
define sex /across;
define percent/'ColPctN' computed format=percent8.;
compute before;
sum1=_c2_ ;
sum2=_c4_;
endcomp;
compute percent;
if missing(diabetes) then do;
_sum1=sum1-_c2_;
_sum2=sum2-_c4_;
end;
else do;
_c3_=_c2_/_sum1;
_c5_=_c4_/_sum2;
end;
endcomp;
compute after /style={just=right asis=on};
*str=cat('All : ',sum1,' 100% ',sum2,' 100%');
line @5'All:' @26 sum1 best4. @42 '100%' @64 sum2 best4. @80 '100%';
endcomp;
run;
ods pdf close;
[/pre]


Ksharp
newbi
SAS Employee
Based on your recommendation I did create "dummy" variables - flag1 and flag 2. With that I was able to sum the value of sales, goals and calcpct for each sales rep. But the value was appearing in column for each rep insted of row:

[Pre]
Rep
Sales Goals calcpct

[/Pre]

I still can't figure out how to display the Goal and Calculation below Sales values.

[Pre]
Rep
100
Sales
-------------------------------
Total Sales
Goals
Calcpct

[/Pre]

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
  • 19 replies
  • 1955 views
  • 0 likes
  • 4 in conversation