Help using Base SAS procedures

How to delete blank rows in a header that is created via an across statement in proc report

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

How to delete blank rows in a header that is created via an across statement in proc report

Hi,

 

I'm trying to suppress blank rows above and below a header created via an across statement in a proc report (SAS 9.2) . I'd like that the header contains the 2 solid lines (one above and one below) as the example below but with the blank rows deleted. Below the example and the corresponding SAS code I used.

 

Many thanks for your help,

Ingrid

 

Example :


TITLE_1

 

Region: Pacific
________________________________________________________________________________

                                                                                                                                                        TO BE DELETED

                                                                                       Kuala
                                    Auckland   Canberra   Jakarta   Lumpur        Manila       Singapore
                                                                                                                                                       TO BE DELETED
____________________________________________________________________________TO BE DELETED
Men's Casual                                $24,733    $373,908  $106,657 $128,309     $28,761

Men's Dress                $4,892       $4,231      $186,631 $55,667    $144,151    $30,619

Slipper                        $33,000      $44,121    $22,060   $83,212   $171,735     $36,612

Women's Casual        $18,189      $15,032    $18,761    $36,110    $131,794

Women's Dress          $42,760      $21,486    $4,659     $61,108     $229,372   $40,056

 

 


________________________________________________________________________________________________________
FOOTNOTE_1

 

SAS code:

 

proc sort data=sashelp.shoes out=shoes;
where region in ('Asia', 'Pacific', 'Canada');
by region product;
run;

data shoes2;
set shoes;
if product in ( "Boot" "Sandal" "Sport Shoe") then pagen = 1;
else pagen = 2;
run;

proc sort data=shoes2;
by region pagen product;
run;

 

proc report nowd data=shoes2 center headline spacing=0 split='|' ls=133 ps=48 missing formchar(1)="_" out=test;

column( '___' region pagen product Subsidiary ,Sales ) ;
define region / noprint '' order order=internal group ;
define pagen / noprint '' order order=internal group ;
define product / with =20 '' order order=internal group ;
define Subsidiary / width=25 '' group order=data across nozero center style(column)=[just=center];
define Sales / width=10 '' group center style(column)=[just=center] ;
break after product/ skip;
break after pagen/ page;

compute before _page_;
line @1 "TITLE_1";
line @1 " ";
line @1 "Region: " region $20.;
endcomp;

compute after _page_;
line @1 132*"_";
line @1 "FOOTNOTE_1 ";
endcomp;
run;

 

 

 


Accepted Solutions
Solution
‎08-08-2016 01:05 AM
SAS Super FREQ
Posts: 8,743

Re: How to delete blank rows in a header that is created via an across statement in proc report

Hi:

  Generally, I find that you do not need to create your own paging variable if you use regular by group processing. The blank line, you can get rid of. You did not specify your destination, so the screen shot below uses ODS HTML and STYLE=JOURNAL. You have some errors and/or inconsistencies in your code.

-- WITH= instead of WIDTH= also, this is a LISTING only option

--headline, spacing, ls, ps, formchar -- these are all LISTING only options and are all ignored by other ODS destinations

--order order=internal group as the usage -- you cannot have both ORDER and GROUP as usage. It seems you want GROUP, so use that with order=internal.

--several places you have style(column)=[just=center]; which is an ODS only option for HTML, RTF or PDF, so this is why your use of LISTING only options is inconsistent with using STYLE(COLUMN)

-- several places you write out your own lines to span the table -- if you just used STYLE=JOURNAL you would not need to do this.

 

cynthia

 

Here's a simplified version of your program using SASHELP.SHOES

use_by_group.png

View solution in original post


All Replies
Solution
‎08-08-2016 01:05 AM
SAS Super FREQ
Posts: 8,743

Re: How to delete blank rows in a header that is created via an across statement in proc report

Hi:

  Generally, I find that you do not need to create your own paging variable if you use regular by group processing. The blank line, you can get rid of. You did not specify your destination, so the screen shot below uses ODS HTML and STYLE=JOURNAL. You have some errors and/or inconsistencies in your code.

-- WITH= instead of WIDTH= also, this is a LISTING only option

--headline, spacing, ls, ps, formchar -- these are all LISTING only options and are all ignored by other ODS destinations

--order order=internal group as the usage -- you cannot have both ORDER and GROUP as usage. It seems you want GROUP, so use that with order=internal.

--several places you have style(column)=[just=center]; which is an ODS only option for HTML, RTF or PDF, so this is why your use of LISTING only options is inconsistent with using STYLE(COLUMN)

-- several places you write out your own lines to span the table -- if you just used STYLE=JOURNAL you would not need to do this.

 

cynthia

 

Here's a simplified version of your program using SASHELP.SHOES

use_by_group.png

New Contributor
Posts: 2

Re: How to delete blank rows in a header that is created via an across statement in proc report

Thanks a lot for the explanation and all these good tips.

A part of the issue was also coming from set up of destination file coding (code not shown in the example I've put above) .

Many thanks again for your help

Ingrid

Super User
Posts: 9,681

Re: How to delete blank rows in a header that is created via an across statement in proc report

I didn't see any blank lines after running your code ?

Try exchange the position of ACROSS variables.

column( '___' region pagen product Sales,Subsidiary ) ;


☑ This topic is SOLVED.

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

Discussion stats
  • 3 replies
  • 269 views
  • 0 likes
  • 3 in conversation