BookmarkSubscribeRSS Feed
s_garg17
Calcite | Level 5

@Cynthia_sas Hi, I am trying to use something analogous to #byval where in I want the text to appear as the header and not title. I am trying to follow the solution given by Cynthia here

 

https://communities.sas.com/t5/ODS-and-Base-Reporting/re-byval-in-header/td-p/316108

 

 however _page_ is not resolved in my code and i cant achieve it.

 

proc report nowindows data=list_ae split='|' missing style(report)=[width=100% cellpadding=0]
style (column)=[protectspecialchars=off asis=on just=c] style(header)=[asis=on just=c];
by byvar;
column ("@R'\fs3\brdrb\brdrs\brdrw40" byvar pageit subjid age sex race aestdtc aeendtc aetext flag aeong_std) ;

define byvar / order order=internal noprint;
define pageit / order order=internal noprint;
define subjid/order order=internal noprint;

define aestdtc /display style(column)=[just=c width=10% rightmargin=1%] "AE Start Date";
define aeendtc /display style(column)=[just=c width=10%] "AE End Date";
define aetext /display style(column)=[just=c width=20%] "AE Body System Code/|AE Preferred Term/|Verbatim Term";
define aeong_std /display style(column)=[just=c width=8%] "Ongoing?";
*define aeterm /display style(column)=[just=c width=8%] "AE Verbatim Term";
define flag /display style(column)=[just=c width=8%] "Treatment Emergent|Serious|Dose Limiting Toxicity";
break after _page_/page;
compute before _page_ ;
pgstr=catx('\',subjid,age,sex,race);
line pgstr $varying100.;

endcomp;

 

run;

 

i get the following error

22759
22760 compute after pageit / style={just=l};
22761 line
22761! "____________________________________________________________________________________________________________________________
22761! ____________________";
22762 line "%str(Note: Treatment-Emergent Adverse Events is defined as any event that occurs on or after the first dose of
22762! study drug administration or any pre-existing event which worsened in severity after dosing.)";
22763 line "%str(Note: Coding used MedDRA version 23.0)";
22764 line "%str(Note: Safety Population = Subjects with at least one dose Dose groups represent subjects initial dose)";
22765 endcomp;
22766
22767 run;

ERROR: The BREAK variable _page_ is not one of the GROUP or
ORDER variables.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE REPORT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

22768
22769 ods rtf close;
22770 ods listing close;
22771

 

 

 

 

 

I also tried making an artificial pageit variable but i still dont get desired output. No error either.

3 REPLIES 3
Cynthia_sas
Diamond | Level 26

Hi:
In that example, the Year and Quarter were only shown in a TITLE statement so that the HEADER text could be verified as correct. My previous program does create a PGSTR text item that can be used in the LINE statement in the COMPUTE BEFORE block. Note that I have both YEAR and QTR as GROUP items with a page option, so that the COMPUTE BEFORE _PAGE_ will cause the PGSTR to be used in the HEADER at the change of the YEAR and QTR.
I see that you have BYVAR, PAGEIT and SUBJID as ORDER items, but none of them will cause a page break when they change. You did not use the PAGE option like I did in my code. Is that because you really meant to have COMPUTE BEFORE BYVAR or COMPUTE BEDORE PAGEIT???
The challenge is that if you want to have the information as a header, sitting on top of the table on each page, then you need to have a page item in PROC REPORT. I don't see where you have that.
Also notice in my earlier program, I have break before year/page. You try to do break before _page_...that won't work. _PAGE_ is a location that is reserved to a COMPUTE block. Again, I would expect to see you have break before BYVAR/page or break before PAGEIT/page or break before SUBJID/page instead of what you have. If I understand your logic, then you have BYVAR, PAGEIT and SUBJID as your NOPRINT items. So it seems to me that you want to have a new page start for every SUBJID? Then a subject can have multiple pages AND multiple by values? That doesn't seem quite right to me if you want the page header to be subjid, age sex and race.
But without data to test with or look at, it's hard to provide a context for your code.
Cynthia
s_garg17
Calcite | Level 5

Hi Cynthia,

 

ok lets start fresh. My objective is to produce a header (not title) which is repeated on every page. It is like #byvar, but I want to use compute block instead cause of the location it gets printed. I am using ODS RTF. I want to have it outputted at either of the 2 locations. this "pgstr that I want to print has subjid in it, so ofcourse I want a page break as it changes.

s_garg17_0-1651804241149.png

 

 

 

 

This is the code I am using

I first create a pageit variable like this,

data list_Ae2;
set list_ae;
by subjid;
pageit=ceil(divide(_n_,9));
run;

proc report nowindows data=list_ae2 split='|' missing style(report)=[width=100% cellpadding=0]
style (column)=[protectspecialchars=off asis=on just=c] style(header)=[asis=on just=c];
by subjid pageit;
column ("@R'\fs3\brdrb\brdrs\brdrw40" pageit subjid age sex race aestdtc aeendtc aetext flag aeong_std aerel) ;


define pageit / order page order=internal noprint;
define subjid/group page order order=internal noprint;
define age/group page order order=internal noprint;
define sex/group page order order=internal noprint;
define race/group page order order=internal noprint ;

define aestdtc /display style(column)=[just=c width=10% rightmargin=1%] "AE Start Date";
define aeendtc /display style(column)=[just=c width=10%] "AE End Date";
define aetext /display style(column)=[just=c width=20%] "AE Body System Code/|AE Preferred Term/|Verbatim Term";
define aeong_std /display style(column)=[just=c width=8%] "Ongoing?";
*define aeterm /display style(column)=[just=c width=8%] "AE Verbatim Term";
define flag /display style(column)=[just=c width=8%] "Treatment Emergent|Serious|Dose Limiting Toxicity";
break after pageit/page;
compute before pageit ;
pgstr=catx('\',subjid,age,sex,race);
line pgstr $varying100.;

endcomp;


compute after _page_ / style={just=l};
* line "________________________________________________________________________________________________________________________________________________";
line "%str(Note: Treatment-Emergent Adverse Events is defined as any event that occurs on or after the first dose of study drug administration or any pre-existing event which worsened in severity after dosing.)";
line "%str(Note: Coding used MedDRA version 23.0)";
line "%str(Note: Safety Population = Subjects with at least one dose Dose groups represent subjects initial dose)";
endcomp;

run;

 

 

I am not getting this pgstr getting printed at all.

 

thanks,

 

Cynthia_sas
Diamond | Level 26

Hi:
In that example, the Year and Quarter were only shown in a TITLE statement so that the HEADER text could be verified as correct. My previous program does create a PGSTR text item that can be used in the LINE statement in the COMPUTE BEFORE block. Note that I have both YEAR and QTR as GROUP items with a page option, so that the COMPUTE BEFORE _PAGE_ will cause the PGSTR to be used in the HEADER at the change of the YEAR and QTR.
I see that you have BYVAR, PAGEIT and SUBJID as ORDER items, but none of them will cause a page break when they change. You did not use the PAGE option like I did in my code. Is that because you really meant to have COMPUTE BEFORE BYVAR or COMPUTE BEDORE PAGEIT???
The challenge is that if you want to have the information as a header, sitting on top of the table on each page, then you need to have a page item in PROC REPORT. I don't see where you have that.
Also notice in my earlier program, I have break before year/page. You try to do break before _page_...that won't work. _PAGE_ is a location that is reserved to a COMPUTE block. Again, I would expect to see you have break before BYVAR/page or break before PAGEIT/page or break before SUBJID/page instead of what you have. If I understand your logic, then you have BYVAR, PAGEIT and SUBJID as your NOPRINT items. So it seems to me that you want to have a new page start for every SUBJID? Then a subject can have multiple pages AND multiple by values? That doesn't seem quite right to me if you want the page header to be subjid, age sex and race.
But without data to test with or look at, it's hard to provide a context for your code.
Cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1425 views
  • 0 likes
  • 2 in conversation