The SAS Output Delivery System and reporting techniques

Help needed to prepare a report

Reply
Occasional Contributor
Posts: 13

Help needed to prepare a report

Hi Team,

I am trying to develop a report for my client.I am attaching a sample output here which i want.

 

This is the data set which i am trying to use

SOCPTsp_i_ssp_c_ssp_i_nssp_c_nssp_c_allni_i_sni_c_s
10005329100435540011100
10005329100186271103000
10017947100000810035500
10018065100376600035500
10027433100186270000000

 

Each column corresponds to a column in the report.

 

any help would be greatly appreciated

 

Esteemed Advisor
Esteemed Advisor
Posts: 7,203

Re: Help needed to prepare a report

So what is your question?  This is a Q&A board, not a contract work board.  To give you some tips, look at manipulateing your data using datasteps and procs to get the numbers you need, then use proc report and ods rtf, to create the output file.

Occasional Contributor
Posts: 13

Re: Help needed to prepare a report

Hi,

Sorry if i was not clear enough .Actually i am able to make some headway in the problem but not able to get the final o/p.basically not able to get the spanning headers correctly.

i have used this programme

 

proc report data=WORK.TEST nowindows missing headline headskip;
column SOC_NAME PT_NAME sp_i_s, SUM=sp_i_s_SUM sp_c_s , SUM=sp_c_s_SUM sp_i_ns, SUM=sp_i_ns_SUM sp_c_ns, SUM=sp_c_ns_SUM sp_c_all, SUM=sp_c_all_SUM ni_i_s, SUM=ni_i_s_SUM ni_c_s, SUM=ni_c_s_SUM;
define SOC_NAME / group 'SOC' missing;
compute SOC_NAME;
if SOC_NAME ne ' ' then hold1=SOC_NAME;
if SOC_NAME eq ' ' and _break_ eq ' ' then SOC_NAME='';
if PT_NAME ne ' ' then SOC_NAME='';
if upcase(_break_)="SOC_NAME" then do;
call define("SOC_NAME", 'style', 'style=[pretext=""]');
end;
if _break_='_RBREAK_' then do;
call define("SOC_NAME", 'style', 'style=[pretext="Grand Total"]');
end;
endcomp;
define PT_NAME / group 'PT_NAME' missing;
compute PT_NAME;
if _break_ eq ' ' then do;
if PT_NAME ne ' ' then hold2=PT_NAME;
if PT_NAME ne ' ' then SOC_NAME='';
end;
endcomp;
define sp_i_s / analysis SUM 'Serious' format=BEST12. missing;
define sp_i_s_SUM / 'Interval' format=BEST12. center;
define sp_c_s / analysis SUM 'Serious' format=BEST12. missing;
define sp_c_s_SUM / 'Cumulative' format=BEST12. center;
define sp_i_ns / analysis SUM 'sp_i_ns' format=BEST12. missing;
define sp_i_ns_SUM / 'Interval' format=BEST12.;
define sp_c_ns / analysis SUM 'sp_c_ns' format=BEST12. missing;
define sp_c_ns_SUM / 'Cumulative' format=BEST12. center;
define sp_c_all / analysis SUM 'sp_c_all' format=BEST12. missing;
define sp_c_all_SUM / 'Cumulative all' format=BEST12. center;
define ni_i_s / analysis SUM 'ni_i_s' format=BEST12. missing;
define ni_i_s_SUM / 'Interval' format=BEST12. center;
define ni_c_s / analysis SUM 'ni_c_s' format=BEST12. missing;
define ni_c_s_SUM / 'Cumulative' format=BEST12. center;
break before SOC_NAME / summarize;
rbreak after / summarize;
run;

Occasional Contributor
Posts: 13

Re: Help needed to prepare a report

Hi Guys,

 I have been able to complete most part.The only problem which i am facing right now is how to remove line between two columns

 

I have my report something like this 

SOCMEDRAPT
Infections and infestationsAcariasis
Infections and infestationsMyiasis
Infections and infestations 
Cardiac DisordersCardiac neoplasms

 

and i want to merge these two columns into one 

 

SOC
                       MedDRA PT
 
                       Infections and infestations
                       Acariasis
                      Myiasis
                      Cardiac Disorders
Cardiac neoplasms

 

Any suggestions here would be greatly appreciated

SAS Super FREQ
Posts: 8,719

Re: Help needed to prepare a report

Hi:

  Since you didn't post any data or explain your destination, it is hard to make concrete suggestions. Here's an example of spanning headers on multiple lines using SASHELP.CLASS:

spanning_headers.png

 

The answer to your question about interior table lines will be very specific to your destination and your desired output.

 

For example, using STYLE=JOURNAL, for the above report, I get this output:

spanning_2.png

cynthia

Occasional Contributor
Posts: 13

Re: Help needed to prepare a report

Hi Cynthis,

Thanks for your detailed annswer with workable code.I have already made some progress regarding my work and is just a few step from what i want as final o/p.

I am facing two problems really here because which i am stuck .

here is what i am able to achieve in sas o/p.sas report o/p

 

 

And this is the actual o/p i require

actual otpt.jpg

 

The other problem which i am facing when i am trying to print this report to PDF o/p.The structure is breaking up like this.This is the actual o/p which is being written by sas

 

actual pdf otpt written by sas.jpg

 

I am not being able to understand the reason for this.Any help would be greatly appreciated here.

 

Thanks!!

SAS Super FREQ
Posts: 8,719

Re: Help needed to prepare a report

[ Edited ]

Hi, can you explain what you mean by "the structure is breaking up" The PDF output looks almost the same as the HTML output, except for the colors, of course. The text wrapping, such as Gastrointestinal disorders being on one line or two are controllable with style overrides.

The odd placement of the strings "SOC" and "MedDRA PT" do not make sense to me. SOC looks like it's floating for no reason in the header area. What you show for the PDF in the header area is happening because your spanning headers are specified incorrectly and PDF thought you wanted the headers on the 2 row of the header area and not hte 3rd row. PROC REPORT constructs the header area one row at a time.

Please review my example using SASHELP.CLASS. Note how parentheses are used. I numbered the spanning headers so you could see exactly how to get things on the correct line. PROC REPORT works from the TOP down. Note how my string 3 is immediately above the 2 columns for NAME and AGE -- I can't suddenly "split" that area into 2 columns. So I don't know what you want to get. You haven't posted any data or your new code. If you want PDF, then you need to work with that destination. You can't compare the SAS Report output from EG with the PDF output because, as you see, the output does look different and without knowing whether you used different code or the same code for both outputs, it's hard to comment. Generally PDF output from EG is portrait orientation and your output looks like landscape orientation, so I suspect that you might have used ODS statements to generate the output???

 

  Since you did not post any code or data, all I can do is revise the SASHELP.CLASS example and hope that something there helps you figure out your spanning headers.

 

icky2.png

cynthia

Ask a Question
Discussion stats
  • 6 replies
  • 415 views
  • 1 like
  • 3 in conversation