The SAS Output Delivery System and reporting techniques

Proc Report refinement with style and title management

Reply
Learner
Posts: 1

Proc Report refinement with style and title management

Hi,

 

I'm trying to produce a report which has the column titles just above each data row in an ordered input file.  In addition, I'm using a Line statement to show the value of the sorted variable, and wanted it the same color as tht titles across all rows, centered. 

 

What I have so far is:

 

ods escapechar='^';

proc report data=sashelp.baseball

style(header)={borderwidth=1 background=CXC0C0C0 just=c vjust=m font_weight=bold};

where team like 'S%';

 

column team name position salary;

 

define team / display order noprint f=$60.;

define name / display 'Player' f=$60.;

define position / display;

define salary / display;

 

compute before / style={color=white background=CX003366};

line "Test For Proc Report";

endcomp;

 

compute before team / style={just=left};

line 'Start of Season';

l='^S={background=CX003366 color=white just=c}Team '||team;

line '^S={background=CX003366 color=white just=c}' team $;

endcomp;

run;

 

in this example, the team titles show above the members of that team in white letters with a blue background.  I need to have the entire line blue and the team name centered without the other lines in that compute block centered.  Apparently the compute style overrides the embedded line style. 

 

I'd also like to be able to have the column titles between the team name and the rows of the players.  Is that possible?

 

Thanks!

 

--Ben

 

Grand Advisor
Posts: 10,194

Re: Proc Report refinement with style and title management

Can you show an example of what this output should look like for two teams?

Regular Contributor
Posts: 163

Re: Proc Report refinement with style and title management

Would like to see something like this:

Capture.PNG

 

 

Grand Advisor
Posts: 9,567

Re: Proc Report refinement with style and title management

How about this one :


proc sort data=sashelp.baseball out=baseball;by team;run;
data have;
 set baseball;
 by team;
 where team like 'S%';
 if first.team then group+1;
run;

ods escapechar='^';
proc report data=have nowd noheader; 
column team group name position salary;
 
define group/ order noprint; 
define team / order noprint f=$60.;
define name / display 'Player' f=$60.;
define position / display style={cellwidth=4cm};
define salary / display style={cellwidth=4cm};
 
compute before _page_/ style={just=c color=white background=CX003366};
line "Test For Proc Report";
endcomp;

compute before/style={just=l};
line 'Start of Season';
endcomp;
 
compute before team/style(lines)={background=CX003366 color=white just=c} ;
line Team $20.;
endcomp;

compute before group
/style(lines)={borderwidth=1 background=CXC0C0C0 just=c vjust=m font_weight=bold} ;
line @2'Player' @22'Position(s) in 1986' @65'1987 Salary in $ Thousands';
endcomp;
run;
 

Attachment
Regular Contributor
Posts: 163

Re: Proc Report refinement with style and title management

Interesting.  That's an approach I hadn't considered.  The only down side I see is trying to align the titles above the columns.  The actual project has the output going to an excel spreadsheet with the tagsets.excelxp destination.  Will see if there is a way to 'suggest' alignment information.

 

Thanks!

 

--Ben

SAS Super FREQ
Posts: 8,716

Re: Proc Report refinement with style and title management

Hi, the LINE statement will NOT work the way you envision. All the @ sign controls are ignored by ODS destinations. Just FYI. I may have something similar -- I'll check when I'm on the other computer.
cynthia
Grand Advisor
Posts: 9,567

Re: Proc Report refinement with style and title management

OK. Try this one :






proc sort data=sashelp.baseball out=baseball;by team;run;
data have;
length name position new_salary $ 40;
 set baseball;
 by team;
 where team like 'S%';
 if first.team then group+1;
 new_salary=put(salary,best.-l);
 drop salary;
run;
ods tagsets.excelxp file='/folders/myfolders/x.xml';
ods escapechar='^';
proc report data=have nowd noheader
style(summary)={borderwidth=1 background=CXC0C0C0 just=c vjust=m font_weight=bold} ; 
column team group name position new_salary;
 
define group/ order noprint; 
define team / order noprint ;
define name / display 'Player';
define position / display ;
define new_salary / display style={just=right};
 
compute before _page_/ style={just=c color=white background=CX003366};
line "Test For Proc Report";
endcomp;

compute before/style={just=l};
line 'Start of Season';
endcomp;
 
compute before team/style={background=CX003366 color=white just=c} ;
line Team $20.;
endcomp;

compute before group;
name='Player';
position='Position(s) in 1986';
new_salary='1987 Salary in $ Thousands';
endcomp;

break before group/summarize;
run;
ods tagsets.excelxp close;
 


Attachment
Regular Contributor
Posts: 163

Re: Proc Report refinement with style and title management

Ok, that's just plain slick. Smiley Happy  Outstanding!

 

Thank you so much! It does exactly what I was looking for.  Just couldn't put it quite together.

 

This will help a lot on the actual project I'm working on.

 

--Ben

Ask a Question
Discussion stats
  • 7 replies
  • 452 views
  • 1 like
  • 5 in conversation