The SAS Output Delivery System and reporting techniques

Proc Report ~ Need a bold line for the end of report

Accepted Solution Solved
Reply
Contributor
Posts: 31
Accepted Solution

Proc Report ~ Need a bold line for the end of report

Item 1

Dept 1

Marginal

29

0

  1. 0.0%
  2. 0.00

1

Cumulative

29

0

  1. 0.0%
  2. 0.00

1

Dept 2

Marginal

80

1

  1. 2.8%
  2. 0.00

1

Cumulative

80

1

  1. 2.8%
  2. 0.13

2

I have code that sets the first two columns with top and bottom border white.  These white lines are basically great. There is BOLD border when the value of the first column changes.  For some reason, it is NOT showing in my example above.  There should be a thick border at the top of the first row.  I have that border set in a compute item;   The border is extra thick to make it easier to read.  However, there are two issues.

1.  The very last row in the report shows as above with no border at the last two columns.   This is because I set them to white in the define statement.  I would like for the BORDER of the last row of the report to be black.

2.  No matter what I try (see compute dept; statement that is commented out), I can't get a border above the second column when that value changes.  Here is the error msg when I uncomment that compute dept statement:

     ERROR: Invalid column specification in CALL DEFINE.

NOTE:  Argument 1 to function DEFINE at line 1 column 34 is invalid.

      ERROR: Invalid column specification in CALL DEFINE.

NOTE:  Argument 1 to function DEFINE at line 2 column 34 is invalid.

I can live with issue 2, but issue 1 needs to be resolved.

I attached the code since I can't paste it.  Notice my attempts to correct this issue are commented out.  I have tried to use rbreak and compute after... but not working to make the border in the very last row of the report black under the first two columns black.

thanks!

Linda

Attachment

Accepted Solutions
Solution
‎05-16-2012 12:30 AM
SAS Super FREQ
Posts: 8,740

Re: Proc Report ~ Need a bold line for the end of report

Hi:

  I am not certain that the program you posted is actually working correctly. I looked at the program in your ZIP file and do not see a RUN; before the ODS RTF CLOSE; statement. Without a RUN; what make the PROC REPORT actually produce output. Generally if your close an ODS destination before a procedure runs, you don't get output in te RTF file. There's also quite a bit commented out. So I'm confused whether this is the code that actually produced your screen shot or whether this is the code before or after the code that produced your screen shot. Without any data, and only the program, it's going to be hard to try to replicate your issue without making some fake data and then trying to figure out which statements in your program should stay uncommented or not.

  

  I see that you have COUNT and COUNT2 in your COLUMN statement -- which would normally suggest that they are variables in the data set. You don't have any usage for them (DISPLAY, ORDER, GROUP, COMPUTED, etc). Without any usage, if they ARE variables in the data set, then the default usage is DISPLAY. If you mean for them to be a usage of COMPUTED (because you increment COUNT+1), then PROC REPORT doesn't know that because you don't have a suage of COMPUTED in the DEFINE statement.

    

  In your COMPUTE block for item, you have this:

compute item;

   if word ^= '' and count ^=1 then call define(_row_,'style','style=[bordertopcolor=black bordertopwidth=4]');

endcomp;

however, this is your COLUMN statement::  column item dept category Count count2 perc;

  I do not see the WORD report item in your COLUMN statement. Where is WORD coming from? If the report item (such as WORD) is not in the COLUMN statement, you can't use it in your COMPUTE block. And if you did have WORD in your COLUMN statement, it would have to appear in the COLUMN statement -before- the ITEM variable if you hope to use it in your COMPUTE block. PROC REPORT does NOT have a PDV in the same way as the DATA step -- so all you can use in an IF statement are the items that physically appear in the COMPUTE block or items that are temporary variables that you create in COMPUTE blocks. I only found WORD appear 1 time in your code.

  This is where actually seeing some data, your actual data would be useful. Understanding where WORD comes from and where COUNT and COUNT2 come from and why you don't have usages for COUNT and COUNT2  is going to be necessary before any suggested changes can be attempted. If you can't post your real data, then perhaps you can use SASHELP.CLASS or SASHELP.CARS to make some dummy data or test your code.

  Also, you have CATEGORY in your COLUMN statement, but you have a DEFINE statement for RATING (but not DEFINE for CATEGORY in your code) -- Now, you don't necessarily NEED a to have a DEFINE statement for CATEGORY if you want to take all the DEFAULTS, fur I'm curious about why RATING does not appear in your COLUMN statement. I count 6 report items in your COLUMN statement, but I'm not sure how many report columns you have in your output screenshot -- I was expecting to see only 6 columns, but it looks like there are more columns than 6 columns in your screen shot, again leading me to wonder how your posted code produced the screenshot. Also, you have headings in your code, but you don't show the headings in the screenshot, which makes the output you posted confusing to me, at least.

  You might want to work with Tech Support on this, especially if you feel that you cannot post any data or can't, for some reason post your actual program.

cynthia

View solution in original post


All Replies
Solution
‎05-16-2012 12:30 AM
SAS Super FREQ
Posts: 8,740

Re: Proc Report ~ Need a bold line for the end of report

Hi:

  I am not certain that the program you posted is actually working correctly. I looked at the program in your ZIP file and do not see a RUN; before the ODS RTF CLOSE; statement. Without a RUN; what make the PROC REPORT actually produce output. Generally if your close an ODS destination before a procedure runs, you don't get output in te RTF file. There's also quite a bit commented out. So I'm confused whether this is the code that actually produced your screen shot or whether this is the code before or after the code that produced your screen shot. Without any data, and only the program, it's going to be hard to try to replicate your issue without making some fake data and then trying to figure out which statements in your program should stay uncommented or not.

  

  I see that you have COUNT and COUNT2 in your COLUMN statement -- which would normally suggest that they are variables in the data set. You don't have any usage for them (DISPLAY, ORDER, GROUP, COMPUTED, etc). Without any usage, if they ARE variables in the data set, then the default usage is DISPLAY. If you mean for them to be a usage of COMPUTED (because you increment COUNT+1), then PROC REPORT doesn't know that because you don't have a suage of COMPUTED in the DEFINE statement.

    

  In your COMPUTE block for item, you have this:

compute item;

   if word ^= '' and count ^=1 then call define(_row_,'style','style=[bordertopcolor=black bordertopwidth=4]');

endcomp;

however, this is your COLUMN statement::  column item dept category Count count2 perc;

  I do not see the WORD report item in your COLUMN statement. Where is WORD coming from? If the report item (such as WORD) is not in the COLUMN statement, you can't use it in your COMPUTE block. And if you did have WORD in your COLUMN statement, it would have to appear in the COLUMN statement -before- the ITEM variable if you hope to use it in your COMPUTE block. PROC REPORT does NOT have a PDV in the same way as the DATA step -- so all you can use in an IF statement are the items that physically appear in the COMPUTE block or items that are temporary variables that you create in COMPUTE blocks. I only found WORD appear 1 time in your code.

  This is where actually seeing some data, your actual data would be useful. Understanding where WORD comes from and where COUNT and COUNT2 come from and why you don't have usages for COUNT and COUNT2  is going to be necessary before any suggested changes can be attempted. If you can't post your real data, then perhaps you can use SASHELP.CLASS or SASHELP.CARS to make some dummy data or test your code.

  Also, you have CATEGORY in your COLUMN statement, but you have a DEFINE statement for RATING (but not DEFINE for CATEGORY in your code) -- Now, you don't necessarily NEED a to have a DEFINE statement for CATEGORY if you want to take all the DEFAULTS, fur I'm curious about why RATING does not appear in your COLUMN statement. I count 6 report items in your COLUMN statement, but I'm not sure how many report columns you have in your output screenshot -- I was expecting to see only 6 columns, but it looks like there are more columns than 6 columns in your screen shot, again leading me to wonder how your posted code produced the screenshot. Also, you have headings in your code, but you don't show the headings in the screenshot, which makes the output you posted confusing to me, at least.

  You might want to work with Tech Support on this, especially if you feel that you cannot post any data or can't, for some reason post your actual program.

cynthia

Contributor
Posts: 31

Re: Proc Report ~ Need a bold line for the end of report

Please accept my apologies for the program I sent you.  I work with very senstive data, and tried to hastily change the var names and doctor up the results.  I have written the program with SASHELP.Cars which perfectly displays my issue.  Since I cannot attach anymore documents to this reply, I will create another request.

Again, so very sorry to have taken up your time. I understand now to convert to SASHELP data sets, to make it easier to run/read. 

Sincerely,

Linda

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 956 views
  • 0 likes
  • 2 in conversation