BookmarkSubscribeRSS Feed
deleted_user
Not applicable
my report has detail info for each department and then summary for that department -- can I create a box around the summary info.
EX:
Department TITLE GENDER ETHNICITY NAME
CHEM Professor M Black XXXX

-----------------------------------------------------------------------------------------------
| Total Males: 0 Females: 1 |
| --------------------------------------------------------------------------------------------|
| Whites: 0 0 |
| Blacks 1 0 |
|_____________________________________________________|

Is it possible to get the box?
Please give me any suggestions.

Thank you
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
Starting in SAS 9.2, you might be able to use the new "text decoration" style attributes to put lines above and under your special text. But until then, you'd have to play around with underscores or dashes. Since you are creating a stored process for your output, a lot depends on where the users are going to be receiving stored process results.

For example, if your users were getting the stored process results in Word, you might be able to use RTF control strings to put your extra summary information in a table (which is essentially a box), but RTF control strings won't work in Web Report Studio or Excel or PowerPoint.

If you were ONLY producing LISTING output (what you see in the SAS Output Window), you could use PUT statements to write underscores and dashes to simulate a box -- however, these PUT statements also do not translate well when run as a stored process. For example...consider that you put your information into a box constructed of underscores and dashes. Then your users run that stored process and get the results in Excel. Do you really want them to see a row of underscores taking up space in Excel?

SAS creates tables that contain the same number of columns on EVERY row. So when you start off with a DETAIL report, you are making 1 table. If you write summary lines to that table, you are stuck with the boundaries and number of columns in the original detail table. PROC REPORT lets you write lines that span the columns and DATA _NULL_ lets you write table footers that would span all the columns, but essentially, what you want to do (with writing your own box at a break point) is more like the kind of report we used to produce in the mainframe days, when the printer did not have any fancy fonts or lines and we had to make all our boxes and highlights with underscores and dashes.

The whole purpose of stored processes is to allow the results to come back to the user in the best way for the client application -- so the users see the results in a way that looks nice in their client application.

You might consider contacting Tech Support with this problem, as they can collect information on exactly WHICH client apps are going to be receiving the stored process results and they may be able to come up with something that will work for those client applications. Or the other thing, you could do is experiment with giving the users something different from what they've gotten in the past, but which will, perhaps, in the long run, work better for them in what they ultimately do with the results from the stored process (print, email, etc). Run the program below and see whether something like this might work for your users. Right now, the program only shows the Chem department, but there are other things you can do with SAS Macro programming to generate this "set" of reports for every department.

cynthia
[pre]
** Make some data;
data sfile1;
length Name $8. Department $20. Primary_Ethnicity_Desc $10.
Primary_Ethnicity 3 Gender $1;
infile datalines dsd;
input Name $ gender $ Department $
primary_ethnicity primary_ethnicity_desc $;
format Department $20. Primary_Ethnicity_Desc $10.;
return;
datalines;
Alfred,M,Chem,3,Hispanic
Barb,F,Engl,2,Black
Carla,F,Chem,3,Hispanic
Dana,F,Engl,1,White
Edward,M,Chem,1,White
Frank,M,Engl,2,Black
Gina,F,Chem,2,Black
Hermione,F,Engl,1,White
Ian,M,Engl,1,White
John,M,Chem,2,Black
Kathy,F,Chem,2,Black
Louise,F,Chem,1,White
Mary,F,Chem,2,Black
Nina,F,Engl,3,Hispanic
Oscar,M,Engl,3,Hispanic
Paul,M,Chem,1,White
Quentin,M,Engl,3,Hispanic
Ray,M,Engl,2,Black
Steve,M,Engl,3,Hispanic
Tomas,M,Engl,3,Hispanic
Umberto,M,Chem,3,Hispanic
Victoria,F,Chem,3,White
Will,M,Engl,2,Black
Xavier,M,Chem,1,White
Yvette,F,Engl,2,Black
Zach,M,Engl,2,Black
;
run;

title;
ods listing close;
options center;

** Use PROC PRINT to get the "detail" report for everybody.;
** Use Proc Tabulate to get a "pretty" summary table in a box.;
ods html file='c:\temp\pretty_summary.html' style=egdefault;

proc print data=sfile1;
title "Chemistry Department Detail";
where department = "Chem";
by department;
id department;
var name gender primary_ethnicity_desc;
run;

proc tabulate data=sfile1 f=comma6.;
where department = "Chem";
title "Chemistry Summary Information";
class department gender primary_ethnicity_desc ;

table (all='Department'*Department='')
(all='Ethnicity'*primary_ethnicity_desc='')
(all='Gender'*gender=''),
all=''*n='Grand Total' / box='Example 2';

keylabel N=' '
All='Total';
label primary_ethnicity_desc = 'Ethnicity';
run;
ods html close;

[/pre]

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 990 views
  • 0 likes
  • 2 in conversation