The SAS Output Delivery System and reporting techniques

proc report with field names on right side of report

Reply
Contributor
Posts: 25

proc report with field names on right side of report

Is it possible to create a report that looks like the attached with some field names and data on the right side of the report? Thanks
Attachment
Super User
Posts: 11,144

Re: proc report with field names on right side of report

Can you provide an example of what you want it to actually look like? I am afraid that "like the attached with some field names and data on the right side of the report" leaves a lot of interpretation as to what the desired output may be. We could spend a lot of time coming up with something that sounds like it matches that requirement but doesn't yield what you want.

 

Also do you have a specific ODS destination in mind such as RTF, PDF or HTML as those may require different approaches.

Contributor
Posts: 37

Re: proc report with field names on right side of report


ballardw wrote:

Can you provide an example of what you want it to actually look like? I am afraid that "like the attached with some field names and data on the right side of the report" leaves a lot of interpretation as to what the desired output may be. We could spend a lot of time coming up with something that sounds like it matches that requirement but doesn't yield what you want.

 

Also do you have a specific ODS destination in mind such as RTF, PDF or HTML as those may require different approaches.


Please see the document that was attached to the original post (capture.png) for the layout of the report. It is to be output to pdf.

Super User
Posts: 11,144

Re: proc report with field names on right side of report

So, I'm not sure what you actually meant by "right side of the report". I saw a number of cells but could not tell where "right" started as there were multiple columns.

 

I think that you might look into Proc Forms. The procedure displays variables on specified line and column. The procedure was designed for line printer output.

 

 

 

Contributor
Posts: 37

Re: proc report with field names on right side of report


ballardw wrote:

So, I'm not sure what you actually meant by "right side of the report". I saw a number of cells but could not tell where "right" started as there were multiple columns.

 

I think that you might look into Proc Forms. The procedure displays variables on specified line and column. The procedure was designed for line printer output.

 

 

 


I was referring to fields like Relationship, Component, Group ID and Expiration Date along with their associated data that are on the right side of the report. I've never seen output like that with field names on the right side. Everything I've seen is with field names on the left or across the top.

 

I'll look into proc forms.

 

Thanks

SAS Super FREQ
Posts: 706

Re: proc report with field names on right side of report

Ideally you should use the Report Writing Interface of the DATA Step. It gives you total control of the layout of your report.

 

On the other hand you could prepare your data beforehand so that it fits into the columns of your report and then use Proc REPORT.

 

I would go for the Report Writing Interface

 

 

Contributor
Posts: 37

Re: proc report with field names on right side of report


Bruno_SAS wrote:

Ideally you should use the Report Writing Interface of the DATA Step. It gives you total control of the layout of your report.

 

On the other hand you could prepare your data beforehand so that it fits into the columns of your report and then use Proc REPORT.

 

I would go for the Report Writing Interface

 

 


I'll look at that. I looked at the proc forms but that looks more like something to use for mailing labels. I'm don't think I could do the header/detail with that. Thanks.

SAS Super FREQ
Posts: 8,820

Re: proc report with field names on right side of report

Hi:

  As an example, here's something partial to show that with some simple data manipulation to get your data structured for the report, you could do this with PROC REPORT. For example, by making 4 variables for your data: c1hdr, c1data, c2hdr, c2data, and then some "helper" variables for section and sectord to aid in ordering and allowing you to have your divider lines, I came up with this output,

 

example_proc_report.png

 

based on the program below:

data formdata;
  length section sectord 8 c1hdr c1data c2hdr c2data $100 ;
  infile datalines dlm=',' dsd;
  input section sectord c1hdr $ c1data $ c2hdr $ c2data $;
return;
datalines;
1,1,"Member First Name & Member Last Name:","Jane Doe",,
1,2,"Member DOB","01/01/1965",,
1,3,"Facet Member Key (if applicable)","xxxxxxxxxx",,
1,4,"Date Range:", "Input",,
1,5,"Source:","DWH_HC3",,
2,1,"Address Type:","Home","Phone Number","(xxx) xxx-xxxx"
2,2,"Mailing Address:","1234 Main Street",,
2,3,"City","Hometown",,
2,4,"State","State",,
2,5,"Zip","12345",,
3,1,"Policy Name","UHC (OTHER) - NLWC","Relationship:","Subscriber"
3,2,"Health Plan",,"Component",
3,3,"Customer ID","0227037","Group ID:","0227037"
3,4,"Effective Date:","09/20/2013","Expiration Date","12/30/9999"
;
run;

ods rtf file='c:\temp\testform.rtf';
proc report data=formdata nowd
  style(report)={rules=none frame=voide cellspacing=0}
  style(lines)={background=cxcccccc color=black fontweight=bold just=l};
  column section sectord c1hdr c1data c2hdr c2data;
  define section / order noprint;
  define sectord / order noprint;
  define c1hdr / ' ' style(column)={color=red};
  define c1data / ' ';
  define c2hdr / ' ' style(column)={color=red};
  define c2data / ' ';
compute before section;
  length secthdr $250;
  if section = 1 then secthdr = 'Summary Report_DWH_HC3';
  else if section = 2 then secthdr = 'Demographics';
  else if section = 3 then secthdr = catx(' ','Eligibility','**NOTE:',
                                          'Need all of the eligibility - would be for the date range selected');
  lg = length(secthdr);
  line secthdr $varying. lg;
endcomp;
run;
ods rtf close;

 

And, of course, you could do different data manipulation to make more "sections" or do more cosmetically, but this will give you the general idea.

  

cynthia

Ask a Question
Discussion stats
  • 7 replies
  • 522 views
  • 0 likes
  • 5 in conversation