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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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