To see the design specification for %npcttab, click here.
%npcttab calls other macros. For a list of dependencies, click here.
Note: If you see a misalignment of the columns in any example of the output shown below then this is caused by the html editor I am using and is not caused by a bug in the reporting macro.
- Will handle up to three levels of reporting (not counting using "by" variables), referred to as high, mid and low levels.
- Can produce a correctly formatted report with only two parameters set
- Variables defined to the level parameters can be formatted or unformatted. Formatted numeric or formatted character values will be expanded internally into plain text in new variables and these new variables will be used in the report.
- You can define a term that is all low level items combined to the parameter anylowlvl= . It will calculate unique subject counts and percentage for this term and will always show this at the top of the low level terms for the mid level category no matter what the alphabetic order or count.
- Total for all treatment groups can be displayed using total=yes. There is no need to set this up in the input data.
- You can define a dataset to the dsall= parameter and it will display all the terms it finds in this dataset as zero values if it is not represented in the input data.
- Report will automatically fit the full page width if allowed to default.
- Missing values in treatment arms with no observations will be plugged with zeroes.
- Spacing between treatment arm columns can be adjusted.
- Indentation of level terms is adjustable (uniformly).
- Default order of high, mid and low level terms will be in descending subject count order for the total of all treatment groups, whether that total be displayed or not. You can specify a treatment arm value to use, instead of the total for all treatment groups, for this descending order.
- You can specify variables to highlvlord= , midlvlord= and lowlvlord= to order the terms. These variables can be numeric or character.
- Event counts can be optionally displayed using the events=yes parameter setting.
- Decimal places to be used for unique subject counts and event counts can be specified.
- Calculation and display of percentages can be limited to specified treatment arm values if required (so long as event counts are not requested).
- p-values can be displayed for the Fisher's Exact test, the Chi-square test or the Cochran-Armitage trend test (two-sided, one-sided-left or one-sided-right).
- p-value calculations can be limited to specified treatment arm values.
- p-value display can be limited to those p-values meeting a condition such as pvalkeep=<0.05 .
- A paging variable can be specified to pagevar= to control paging if this is set up in the input data.
- Minimum counts or percentages can be specified to limit categories displayed. This minimum can be applied to a specific treatment arm value, the total for all treatment arm or for any treatment arm.
- Individual column widths and spacing can be specified to override those values chosen by the macro.
- Labels can be assigned to individual columns or groups of columns using the trtvarlist= parameter.
- Easy to use for ISS Reporting
There are several demonstrations and each of them will build on the previous demonstrations. It would be a very good idea if you tried this out yourself using an interactive SAS® software session. If you are using a laptop for these demonstrations or your PC at home then the following code will function using SAS® Learning Edition . You will learn more if you actually submit the code and see the results and SAS Learning Edition is an inexpensive and worthwhile alternative to owning a full copy of SAS software.
When using %npcttab you would typically merge data with a "demog" dataset
both to select on the population ("Full Analysis Set" etc.) and to add
the treatment arm variable. This will be done in the code so you can see
what a typical call to the macro looks like.
First the Formats
First we need to set up some formats and informats that we will be using to create the output. You should always run this before running any of the demos below - but you only have to do it once per SAS session. You might need to refer back to this code so that you can see what the formats contain. I have set up some system options as well. If you take a look at my "sasautos" option you will see I have all my macros in one folder. Normally the clinical macros and utility macros go in different folders but I do all my macro development in one folder and split them later.
/* %npcttab: Pre-demo formats and system options */ options noovp nodate nonumber center missing=" " formchar='|_---|+|---+=|-/\<>*'
sasautos=("C:\spectre\macros" SASAUTOS) ls=78 ps=63;title1;
proc format;
value racecd
1="CAUCASIAN"
2="BLACK"
3="ASIAN"
4="HISPANIC"
5="OTHER"
;
value sexcd
1="MALE"
2="FEMALE"
;
value trtcd
1="Ambident (1g/day)"
2="Betamax (500mg/day)"
3="No treatment"
;
*- 1-9 = study 101+102, 11-19 = study 301+302 -;
value trtcdx
1="Placebo"
2="Drug A"
3="Drug B"
9="Total"
11="Placebo"
12="Drug A"
13="Drug B"
19="Total"
;
value trtnarr
1="Ambident@(1g/day)"
2="Betamax@(500mg/day)"
3="No@treatment"
;
*- 1-9 = Female, 11-19 = Male -;
value trtsex
1="Ambident@(1g/day)"
2="Betamax@(500mg/day)"
9="Total"
11="Ambident@(1g/day)"
12="Betamax@(500mg/day)"
19="Total"
;
value NY
0="NO"
1="YES"
;
value intensity
1="Mild"
2="Moderate"
3="Severe"
;
invalue socord
"General disorders and administration site conditions"=1
"Gastrointestinal disorders"=2
"Nervous system disorders"=3
"Vascular disorders"=4
"Respiratory, thoracic and mediastinal disorders"=5
"Musculoskeletal and connective tissue disorders"=6
OTHER=99
;
run;
Demo 1
The first demonstration is one of the simplest calls you can make to the macro. Note that only three parameters are set. The macro uses a lot of useful information put into global macro variables by the %popfmt macro. That is how it knows what the treatment variable is and the unique patient identifier.
/* %npcttab: Demo 1 */ proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcd,uniqueid=patno invid)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv);
by patno invid;
if _dem and _adv;
run;%npcttab(dsin=adv,midlvl=amsoc,lowlvl=ampt)
The output it produces is below. I have used a portrait layout so there is not much room. You can see that one of the terms, "Abdominal pain NOS", has flowed onto a new line in the first section. This will be corrected in the next demo.
By default, %npcttab shows the "Total" column. This can be suppressed using total=no . Even if you do not show this column, it is still calculated inside the macro so that the totals can be used for ordering the terms in descending count order.
Note that the numbers left of the brackets are the unique patient counts. At the top of each group is the term "ANY AE". This was not in the input data. It was added by the macro and is the default setting of one of the parameters anylowlvl= . If you add up the number of patients then it does not come to the total. The reason for this is that patients can have more than one adverse event and this is the case in the input data. Patients will be counted for each adverse event but will only be counted once in the group.
Note the order of the group terms and the individual AEs. By default it is shown in descending order for the total treatment arm. If more than one AE has the same count then additionally it is shown alphabetically. You will see in a later demo how you can order the terms any way you want to. The term "ANY AE", or whatever else you define to anylowlvl= , will always be shown at the top of the group.
______________________________________________________________________________ Ambident (1g/day) Betamax (500mg/day) Total
(N=9) (N=8) (N=17)
______________________________________________________________________________Gastrointestinal disorders
ANY AE 7 ( 77.8) 8 (100.0) 15 ( 88.2)
Constipation 4 ( 44.4) 5 ( 62.5) 9 ( 52.9)
Nausea 3 ( 33.3) 6 ( 75.0) 9 ( 52.9)
Abdominal pain NOS 2 ( 22.2) 6 ( 75.0) 8 ( 47.1)
Diarrhoea NOS 2 ( 22.2) 6 ( 75.0) 8 ( 47.1)
Vomiting NOS 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)General disorders and administration site conditions
ANY AE 6 ( 66.7) 5 ( 62.5) 11 ( 64.7)
Chest pain 5 ( 55.6) 4 ( 50.0) 9 ( 52.9)
Pain NOS 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)Psychiatric disorders
ANY AE 4 ( 44.4) 7 ( 87.5) 11 ( 64.7)
Insomnia 4 ( 44.4) 7 ( 87.5) 11 ( 64.7)
Anxiety 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)Musculoskeletal and connective tissue disorders
ANY AE 4 ( 44.4) 6 ( 75.0) 10 ( 58.8)
Pain in extremity 3 ( 33.3) 5 ( 62.5) 8 ( 47.1)
Back pain 3 ( 33.3) 4 ( 50.0) 7 ( 41.2)Respiratory, thoracic and mediastinal disorders
ANY AE 5 ( 55.6) 5 ( 62.5) 10 ( 58.8)
Cough 4 ( 44.4) 4 ( 50.0) 8 ( 47.1)
Dyspnoea 3 ( 33.3) 3 ( 37.5) 6 ( 35.3)Vascular disorders
ANY AE 5 ( 55.6) 5 ( 62.5) 10 ( 58.8)
Hypotension NOS 4 ( 44.4) 5 ( 62.5) 9 ( 52.9)
Hypertension NOS 2 ( 22.2) 2 ( 25.0) 4 ( 23.5)Nervous system disorders
ANY AE 2 ( 22.2) 5 ( 62.5) 7 ( 41.2)
Headache 2 ( 22.2) 5 ( 62.5) 7 ( 41.2)
Tremor 2 ( 22.2) 2 ( 25.0) 4 ( 23.5)
Demo 2
In the next demo, the width of the columns will be reduced using a narrower format and the term "ANY AE" will be changed to "Any Adverse Event". The narrower font must be applied before the %popfmt macro is called. This can be done using an extra data step or it can be supplied to the %popfmt macro directly. The second method is more efficient so that technique will be used. The changes to the code are highlighted in bold.
/* %npcttab: Demo 2 */ proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcd,uniqueid=patno invid,trtfmt=trtnarr.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv);
by patno invid;
if _dem and _adv;
run;%npcttab(dsin=adv,midlvl=amsoc,lowlvl=ampt,anylowlvl="Any Adverse Event")
Here is the new output with narrower columns and the new group term "Any Adverse Event".
______________________________________________________________________________ Ambident Betamax
(1g/day) (500mg/day) Total
(N=9) (N=8) (N=17)
______________________________________________________________________________Gastrointestinal disorders
Any Adverse Event 7 ( 77.8) 8 (100.0) 15 ( 88.2)
Constipation 4 ( 44.4) 5 ( 62.5) 9 ( 52.9)
Nausea 3 ( 33.3) 6 ( 75.0) 9 ( 52.9)
Abdominal pain NOS 2 ( 22.2) 6 ( 75.0) 8 ( 47.1)
Diarrhoea NOS 2 ( 22.2) 6 ( 75.0) 8 ( 47.1)
Vomiting NOS 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)General disorders and administration site conditions
Any Adverse Event 6 ( 66.7) 5 ( 62.5) 11 ( 64.7)
Chest pain 5 ( 55.6) 4 ( 50.0) 9 ( 52.9)
Pain NOS 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)Psychiatric disorders
Any Adverse Event 4 ( 44.4) 7 ( 87.5) 11 ( 64.7)
Insomnia 4 ( 44.4) 7 ( 87.5) 11 ( 64.7)
Anxiety 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)Musculoskeletal and connective tissue disorders
Any Adverse Event 4 ( 44.4) 6 ( 75.0) 10 ( 58.8)
Pain in extremity 3 ( 33.3) 5 ( 62.5) 8 ( 47.1)
Back pain 3 ( 33.3) 4 ( 50.0) 7 ( 41.2)Respiratory, thoracic and mediastinal disorders
Any Adverse Event 5 ( 55.6) 5 ( 62.5) 10 ( 58.8)
Cough 4 ( 44.4) 4 ( 50.0) 8 ( 47.1)
Dyspnoea 3 ( 33.3) 3 ( 37.5) 6 ( 35.3)Vascular disorders
Any Adverse Event 5 ( 55.6) 5 ( 62.5) 10 ( 58.8)
Hypotension NOS 4 ( 44.4) 5 ( 62.5) 9 ( 52.9)
Hypertension NOS 2 ( 22.2) 2 ( 25.0) 4 ( 23.5)Nervous system disorders
Any Adverse Event 2 ( 22.2) 5 ( 62.5) 7 ( 41.2)
Headache 2 ( 22.2) 5 ( 62.5) 7 ( 41.2)
Tremor 2 ( 22.2) 2 ( 25.0) 4 ( 23.5)
Demo 3
As mentioned before, the default order is descending order of patient count for the total treatment arm. This can be changed. You can set up special variables for ordering the data and define these to midlvlord= and lowlvlord= . If you want to keep the descending order but not use the total treatment arm for this then you can define the treatment arm value used for ordering to the trtord= parameter. I will set trtord=2 so that it uses the Betamax arm.
/* %npcttab: Demo 3 */ proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcd,uniqueid=patno invid,trtfmt=trtnarr.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv);
by patno invid;
if _dem and _adv;
run;%npcttab(dsin=adv,midlvl=amsoc,lowlvl=ampt,anylowlvl="Any Adverse Event",
trtord=2)Note the new order of the group terms and the individual terms. It uses the patient count for the Betamax column as the first sort key and the alphabetical value as the second key.
______________________________________________________________________________ Ambident Betamax
(1g/day) (500mg/day) Total
(N=9) (N=8) (N=17)
______________________________________________________________________________Gastrointestinal disorders
Any Adverse Event 7 ( 77.8) 8 (100.0) 15 ( 88.2)
Abdominal pain NOS 2 ( 22.2) 6 ( 75.0) 8 ( 47.1)
Diarrhoea NOS 2 ( 22.2) 6 ( 75.0) 8 ( 47.1)
Nausea 3 ( 33.3) 6 ( 75.0) 9 ( 52.9)
Constipation 4 ( 44.4) 5 ( 62.5) 9 ( 52.9)
Vomiting NOS 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)Psychiatric disorders
Any Adverse Event 4 ( 44.4) 7 ( 87.5) 11 ( 64.7)
Insomnia 4 ( 44.4) 7 ( 87.5) 11 ( 64.7)
Anxiety 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)Musculoskeletal and connective tissue disorders
Any Adverse Event 4 ( 44.4) 6 ( 75.0) 10 ( 58.8)
Pain in extremity 3 ( 33.3) 5 ( 62.5) 8 ( 47.1)
Back pain 3 ( 33.3) 4 ( 50.0) 7 ( 41.2)General disorders and administration site conditions
Any Adverse Event 6 ( 66.7) 5 ( 62.5) 11 ( 64.7)
Chest pain 5 ( 55.6) 4 ( 50.0) 9 ( 52.9)
Pain NOS 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)Nervous system disorders
Any Adverse Event 2 ( 22.2) 5 ( 62.5) 7 ( 41.2)
Headache 2 ( 22.2) 5 ( 62.5) 7 ( 41.2)
Tremor 2 ( 22.2) 2 ( 25.0) 4 ( 23.5)Respiratory, thoracic and mediastinal disorders
Any Adverse Event 5 ( 55.6) 5 ( 62.5) 10 ( 58.8)
Cough 4 ( 44.4) 4 ( 50.0) 8 ( 47.1)
Dyspnoea 3 ( 33.3) 3 ( 37.5) 6 ( 35.3)Vascular disorders
Any Adverse Event 5 ( 55.6) 5 ( 62.5) 10 ( 58.8)
Hypotension NOS 4 ( 44.4) 5 ( 62.5) 9 ( 52.9)
Hypertension NOS 2 ( 22.2) 2 ( 25.0) 4 ( 23.5)
Demo 4
The more usual way of ordering the output is to have a specific order for the group terms and to let the lower level terms be displayed in descending patient count order. This might be done by using an informat and mapping the group term to a number. This is done in the code below.
/* %npcttab: Demo 4 */ proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcd,uniqueid=patno invid,trtfmt=trtnarr.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv);
by patno invid;
if _dem and _adv;
socord=input(amsoc,socord.);
run;%npcttab(dsin=adv,midlvlord=socord,midlvl=amsoc,
lowlvl=ampt,anylowlvl="Any Adverse Event")Here is the output with the group terms ordered by the midlvlord= variable socord.
______________________________________________________________________________ Ambident Betamax
(1g/day) (500mg/day) Total
(N=9) (N=8) (N=17)
______________________________________________________________________________General disorders and administration site conditions
Any Adverse Event 6 ( 66.7) 5 ( 62.5) 11 ( 64.7)
Chest pain 5 ( 55.6) 4 ( 50.0) 9 ( 52.9)
Pain NOS 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)Gastrointestinal disorders
Any Adverse Event 7 ( 77.8) 8 (100.0) 15 ( 88.2)
Constipation 4 ( 44.4) 5 ( 62.5) 9 ( 52.9)
Nausea 3 ( 33.3) 6 ( 75.0) 9 ( 52.9)
Abdominal pain NOS 2 ( 22.2) 6 ( 75.0) 8 ( 47.1)
Diarrhoea NOS 2 ( 22.2) 6 ( 75.0) 8 ( 47.1)
Vomiting NOS 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)Nervous system disorders
Any Adverse Event 2 ( 22.2) 5 ( 62.5) 7 ( 41.2)
Headache 2 ( 22.2) 5 ( 62.5) 7 ( 41.2)
Tremor 2 ( 22.2) 2 ( 25.0) 4 ( 23.5)Vascular disorders
Any Adverse Event 5 ( 55.6) 5 ( 62.5) 10 ( 58.8)
Hypotension NOS 4 ( 44.4) 5 ( 62.5) 9 ( 52.9)
Hypertension NOS 2 ( 22.2) 2 ( 25.0) 4 ( 23.5)Respiratory, thoracic and mediastinal disorders
Any Adverse Event 5 ( 55.6) 5 ( 62.5) 10 ( 58.8)
Cough 4 ( 44.4) 4 ( 50.0) 8 ( 47.1)
Dyspnoea 3 ( 33.3) 3 ( 37.5) 6 ( 35.3)Musculoskeletal and connective tissue disorders
Any Adverse Event 4 ( 44.4) 6 ( 75.0) 10 ( 58.8)
Pain in extremity 3 ( 33.3) 5 ( 62.5) 8 ( 47.1)
Back pain 3 ( 33.3) 4 ( 50.0) 7 ( 41.2)Psychiatric disorders
Any Adverse Event 4 ( 44.4) 7 ( 87.5) 11 ( 64.7)
Insomnia 4 ( 44.4) 7 ( 87.5) 11 ( 64.7)
Anxiety 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)
Demo 5
It would be interesting to know how many patients had any sort of adverse event and to see the percentage of the population. This can be done by manipulating the data. We can set up a new group term like "Any System Organ Class" and show the "Any Adverse Event" total on its own with none of the individual AE terms. You can use the droplowlvl= parameter to drop low level terms you do not want displayed.
/* %npcttab: Demo 5 */ proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcd,uniqueid=patno invid,trtfmt=trtnarr.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv);
by patno invid;
if _dem and _adv;
socord=input(amsoc,socord.);
output;
amsoc="Any System Organ Class";
socord=0;
ampt="ZZZZ";
output;
run;%npcttab(dsin=adv,midlvlord=socord,midlvl=amsoc,
lowlvl=ampt,anylowlvl="Any Adverse Event",droplowlvl="ZZZZ")Here is the new output with the "Any System Organ Class" group added.
______________________________________________________________________________ Ambident Betamax
(1g/day) (500mg/day) Total
(N=9) (N=8) (N=17)
______________________________________________________________________________Any System Organ Class
Any Adverse Event 7 ( 77.8) 8 (100.0) 15 ( 88.2)General disorders and administration site conditions
Any Adverse Event 6 ( 66.7) 5 ( 62.5) 11 ( 64.7)
Chest pain 5 ( 55.6) 4 ( 50.0) 9 ( 52.9)
Pain NOS 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)Gastrointestinal disorders
Any Adverse Event 7 ( 77.8) 8 (100.0) 15 ( 88.2)
Constipation 4 ( 44.4) 5 ( 62.5) 9 ( 52.9)
Nausea 3 ( 33.3) 6 ( 75.0) 9 ( 52.9)
Abdominal pain NOS 2 ( 22.2) 6 ( 75.0) 8 ( 47.1)
Diarrhoea NOS 2 ( 22.2) 6 ( 75.0) 8 ( 47.1)
Vomiting NOS 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)Nervous system disorders
Any Adverse Event 2 ( 22.2) 5 ( 62.5) 7 ( 41.2)
Headache 2 ( 22.2) 5 ( 62.5) 7 ( 41.2)
Tremor 2 ( 22.2) 2 ( 25.0) 4 ( 23.5)Vascular disorders
Any Adverse Event 5 ( 55.6) 5 ( 62.5) 10 ( 58.8)
Hypotension NOS 4 ( 44.4) 5 ( 62.5) 9 ( 52.9)
Hypertension NOS 2 ( 22.2) 2 ( 25.0) 4 ( 23.5)Respiratory, thoracic and mediastinal disorders
Any Adverse Event 5 ( 55.6) 5 ( 62.5) 10 ( 58.8)
Cough 4 ( 44.4) 4 ( 50.0) 8 ( 47.1)
Dyspnoea 3 ( 33.3) 3 ( 37.5) 6 ( 35.3)Musculoskeletal and connective tissue disorders
Any Adverse Event 4 ( 44.4) 6 ( 75.0) 10 ( 58.8)
Pain in extremity 3 ( 33.3) 5 ( 62.5) 8 ( 47.1)
Back pain 3 ( 33.3) 4 ( 50.0) 7 ( 41.2)Psychiatric disorders
Any Adverse Event 4 ( 44.4) 7 ( 87.5) 11 ( 64.7)
Insomnia 4 ( 44.4) 7 ( 87.5) 11 ( 64.7)
Anxiety 2 ( 22.2) 3 ( 37.5) 5 ( 29.4)
Demo 6
Event counts will be displayed if you set the option events=yes . This will be activated in the next demo code and total=no will be set to suppress the "Total" column.
/* %npcttab: Demo 6 */ proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcd,uniqueid=patno invid,trtfmt=trtnarr.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv);
by patno invid;
if _dem and _adv;
socord=input(amsoc,socord.);
output;
amsoc="Any System Organ Class";
socord=0;
ampt="ZZZZ";
output;
run;%npcttab(dsin=adv,midlvlord=socord,midlvl=amsoc,total=no,events=yes,
lowlvl=ampt,anylowlvl="Any Adverse Event",droplowlvl="ZZZZ")Here is the output with the event counts. The event counts do add up to the totals, unlike the patient counts. Check if you like. Note that the order of the AEs is the same as for the last demo. The patient counts for the total of all treatment arms are still being used to order the individual terms in descending patient count even though these values are not being displayed.
______________________________________________________________________________ Ambident Betamax
(1g/day) (500mg/day)
(N=9) (N=8)
______________________________________________________________________________Any System Organ Class
Any Adverse Event 7 ( 77.8) 82 8 (100.0) 111General disorders and administration site conditions
Any Adverse Event 6 ( 66.7) 12 5 ( 62.5) 9
Chest pain 5 ( 55.6) 9 4 ( 50.0) 6
Pain NOS 2 ( 22.2) 3 3 ( 37.5) 3Gastrointestinal disorders
Any Adverse Event 7 ( 77.8) 21 8 (100.0) 35
Constipation 4 ( 44.4) 8 5 ( 62.5) 7
Nausea 3 ( 33.3) 3 6 ( 75.0) 6
Abdominal pain NOS 2 ( 22.2) 5 6 ( 75.0) 10
Diarrhoea NOS 2 ( 22.2) 2 6 ( 75.0) 9
Vomiting NOS 2 ( 22.2) 3 3 ( 37.5) 3Nervous system disorders
Any Adverse Event 2 ( 22.2) 7 5 ( 62.5) 15
Headache 2 ( 22.2) 4 5 ( 62.5) 12
Tremor 2 ( 22.2) 3 2 ( 25.0) 3Vascular disorders
Any Adverse Event 5 ( 55.6) 13 5 ( 62.5) 13
Hypotension NOS 4 ( 44.4) 7 5 ( 62.5) 9
Hypertension NOS 2 ( 22.2) 6 2 ( 25.0) 4Respiratory, thoracic and mediastinal disorders
Any Adverse Event 5 ( 55.6) 13 5 ( 62.5) 9
Cough 4 ( 44.4) 7 4 ( 50.0) 5
Dyspnoea 3 ( 33.3) 6 3 ( 37.5) 4Musculoskeletal and connective tissue disorders
Any Adverse Event 4 ( 44.4) 7 6 ( 75.0) 14
Pain in extremity 3 ( 33.3) 3 5 ( 62.5) 8
Back pain 3 ( 33.3) 4 4 ( 50.0) 6Psychiatric disorders
Any Adverse Event 4 ( 44.4) 9 7 ( 87.5) 16
Insomnia 4 ( 44.4) 7 7 ( 87.5) 10
Anxiety 2 ( 22.2) 2 3 ( 37.5) 6
Demo 7
The macro can calculate p-values for you. You can activate this with pvalues=yes . Here is the code changed to do this and we will have a look at what the macro gives us.
/* %npcttab: Demo 7 */ proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcd,uniqueid=patno invid,trtfmt=trtnarr.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv);
by patno invid;
if _dem and _adv;
socord=input(amsoc,socord.);
output;
amsoc="Any System Organ Class";
socord=0;
ampt="ZZZZ";
output;
run;%npcttab(dsin=adv,midlvlord=socord,midlvl=amsoc,
total=no,events=yes,pvalues=yes,
lowlvl=ampt,anylowlvl="Any Adverse Event",droplowlvl="ZZZZ")Here is the output with p-values added. Note that every p-value has the sign "^" after it. The macro will decide what test to use, based on the counts, and it decided to use Fisher's Exact test for all cases. We can ask it to use a specific test and then we can get rid of the "^" sign. This will be done in the next demo.
______________________________________________________________________________ Ambident Betamax
(1g/day) (500mg/day)
(N=9) (N=8) p-value
______________________________________________________________________________Any System Organ Class
Any Adverse Event 7 ( 77.8) 82 8 (100.0) 111 0.471^General disorders and administration site conditions
Any Adverse Event 6 ( 66.7) 12 5 ( 62.5) 9 >0.999^
Chest pain 5 ( 55.6) 9 4 ( 50.0) 6 >0.999^
Pain NOS 2 ( 22.2) 3 3 ( 37.5) 3 0.620^Gastrointestinal disorders
Any Adverse Event 7 ( 77.8) 21 8 (100.0) 35 0.471^
Constipation 4 ( 44.4) 8 5 ( 62.5) 7 0.637^
Nausea 3 ( 33.3) 3 6 ( 75.0) 6 0.153^
Abdominal pain NOS 2 ( 22.2) 5 6 ( 75.0) 10 0.057^
Diarrhoea NOS 2 ( 22.2) 2 6 ( 75.0) 9 0.057^
Vomiting NOS 2 ( 22.2) 3 3 ( 37.5) 3 0.620^Nervous system disorders
Any Adverse Event 2 ( 22.2) 7 5 ( 62.5) 15 0.153^
Headache 2 ( 22.2) 4 5 ( 62.5) 12 0.153^
Tremor 2 ( 22.2) 3 2 ( 25.0) 3 >0.999^Vascular disorders
Any Adverse Event 5 ( 55.6) 13 5 ( 62.5) 13 >0.999^
Hypotension NOS 4 ( 44.4) 7 5 ( 62.5) 9 0.637^
Hypertension NOS 2 ( 22.2) 6 2 ( 25.0) 4 >0.999^Respiratory, thoracic and mediastinal disorders
Any Adverse Event 5 ( 55.6) 13 5 ( 62.5) 9 >0.999^
Cough 4 ( 44.4) 7 4 ( 50.0) 5 >0.999^
Dyspnoea 3 ( 33.3) 6 3 ( 37.5) 4 >0.999^Musculoskeletal and connective tissue disorders
Any Adverse Event 4 ( 44.4) 7 6 ( 75.0) 14 0.335^
Pain in extremity 3 ( 33.3) 3 5 ( 62.5) 8 0.347^
Back pain 3 ( 33.3) 4 4 ( 50.0) 6 0.637^Psychiatric disorders
Any Adverse Event 4 ( 44.4) 9 7 ( 87.5) 16 0.131^
Insomnia 4 ( 44.4) 7 7 ( 87.5) 10 0.131^
Anxiety 2 ( 22.2) 2 3 ( 37.5) 6 0.620^
Demo 8
I am going to improve on the last report by specifically asking for the Fisher's Exact test, setting the symbol at the end of the p-values to null, changing the p-value column label to add the "^" symbol and I will add a footnote to explain the symbol in the p-value label. Also, I will add some labels in the report to explain what the figures are and what the categories are.
/* %npcttab: Demo 8 */ proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcd,uniqueid=patno invid,trtfmt=trtnarr.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv);
by patno invid;
if _dem and _adv;
socord=input(amsoc,socord.);
output;
amsoc="Any System Organ Class";
socord=0;
ampt="ZZZZ";
output;
run;footnote1 "%sysfunc(repeat(_,200))";
%lafootnote(2,"^ Fisher's Exact test comparing the two treatment arms")%npcttab(dsin=adv,midlvlord=socord,midlvl=amsoc,
total=no,events=yes,pvalues=yes,
usetest=fisher,fisherid=,pvallbl="p-value^",
trtlabel=" " "Number of Patients (%) Event Count" " ",
midlvllbl=SYSTEM ORGAN CLASS,lowlvllbl=PREFERRED TERM,
lowlvl=ampt,anylowlvl="Any Adverse Event",droplowlvl="ZZZZ")Here is the output again showing the p-values. This time the p-values are a lot tidier. You can also see the labels I have added.
______________________________________________________________________________
Number of Patients (%) Event Count
Ambident Betamax
SYSTEM ORGAN CLASS (1g/day) (500mg/day)
PREFERRED TERM (N=9) (N=8) p-value^
______________________________________________________________________________Any System Organ Class
Any Adverse Event 7 ( 77.8) 82 8 (100.0) 111 0.471General disorders and administration site conditions
Any Adverse Event 6 ( 66.7) 12 5 ( 62.5) 9 >0.999
Chest pain 5 ( 55.6) 9 4 ( 50.0) 6 >0.999
Pain NOS 2 ( 22.2) 3 3 ( 37.5) 3 0.620Gastrointestinal disorders
Any Adverse Event 7 ( 77.8) 21 8 (100.0) 35 0.471
Constipation 4 ( 44.4) 8 5 ( 62.5) 7 0.637
Nausea 3 ( 33.3) 3 6 ( 75.0) 6 0.153
Abdominal pain NOS 2 ( 22.2) 5 6 ( 75.0) 10 0.057
Diarrhoea NOS 2 ( 22.2) 2 6 ( 75.0) 9 0.057
Vomiting NOS 2 ( 22.2) 3 3 ( 37.5) 3 0.620Nervous system disorders
Any Adverse Event 2 ( 22.2) 7 5 ( 62.5) 15 0.153
Headache 2 ( 22.2) 4 5 ( 62.5) 12 0.153
Tremor 2 ( 22.2) 3 2 ( 25.0) 3 >0.999Vascular disorders
Any Adverse Event 5 ( 55.6) 13 5 ( 62.5) 13 >0.999
Hypotension NOS 4 ( 44.4) 7 5 ( 62.5) 9 0.637
Hypertension NOS 2 ( 22.2) 6 2 ( 25.0) 4 >0.999Respiratory, thoracic and mediastinal disorders
Any Adverse Event 5 ( 55.6) 13 5 ( 62.5) 9 >0.999
Cough 4 ( 44.4) 7 4 ( 50.0) 5 >0.999
Dyspnoea 3 ( 33.3) 6 3 ( 37.5) 4 >0.999Musculoskeletal and connective tissue disorders
Any Adverse Event 4 ( 44.4) 7 6 ( 75.0) 14 0.335
Pain in extremity 3 ( 33.3) 3 5 ( 62.5) 8 0.347
Back pain 3 ( 33.3) 4 4 ( 50.0) 6 0.637Psychiatric disorders
Any Adverse Event 4 ( 44.4) 9 7 ( 87.5) 16 0.131
Insomnia 4 ( 44.4) 7 7 ( 87.5) 10 0.131
Anxiety 2 ( 22.2) 2 3 ( 37.5) 6 0.620
______________________________________________________________________________
^ Fisher's Exact test comparing the two treatment arms
The %npcttab macro is capable of calculating other sorts of p-values. You can find this out from the header of the macro it calls to do this which is %npctpvals . With the awareness you have gained from the last two demos, you should now be in a position to be able to learn from reading the macro header, so we will leave the subject of p-values at this point and drop them from the demonstrations.
Demo 9
So far, all the demonstrations you have seen are for two-level reporting. The macro is capable of doing three level reporting (not counting using "by" variables) but what if you want to do one-level reporting? That's easy. Just set a variable for the low level variable lowlvl= and not midlvl= .
/* %npcttab: Demo 9 */ footnote1;
proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcd,uniqueid=patno invid,trtfmt=trtnarr.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv);
by patno invid;
if _dem and _adv;
run;%npcttab(dsin=adv,
total=no,events=yes,
trtlabel=" " "Number of Patients (%) Event Count" " ",
lowlvllbl=PREFERRED TERM,
lowlvl=ampt,anylowlvl="Any Adverse Event")Here is the output.
______________________________________________________________________________
Number of Patients (%) Event Count
Ambident Betamax
(1g/day) (500mg/day)
PREFERRED TERM (N=9) (N=8)
______________________________________________________________________________Any Adverse Event 7 ( 77.8) 82 8 (100.0) 111
Insomnia 4 ( 44.4) 7 7 ( 87.5) 10
Chest pain 5 ( 55.6) 9 4 ( 50.0) 6
Constipation 4 ( 44.4) 8 5 ( 62.5) 7
Hypotension NOS 4 ( 44.4) 7 5 ( 62.5) 9
Nausea 3 ( 33.3) 3 6 ( 75.0) 6
Abdominal pain NOS 2 ( 22.2) 5 6 ( 75.0) 10
Cough 4 ( 44.4) 7 4 ( 50.0) 5
Diarrhoea NOS 2 ( 22.2) 2 6 ( 75.0) 9
Pain in extremity 3 ( 33.3) 3 5 ( 62.5) 8
Back pain 3 ( 33.3) 4 4 ( 50.0) 6
Headache 2 ( 22.2) 4 5 ( 62.5) 12
Dyspnoea 3 ( 33.3) 6 3 ( 37.5) 4
Anxiety 2 ( 22.2) 2 3 ( 37.5) 6
Pain NOS 2 ( 22.2) 3 3 ( 37.5) 3
Vomiting NOS 2 ( 22.2) 3 3 ( 37.5) 3
Hypertension NOS 2 ( 22.2) 6 2 ( 25.0) 4
Tremor 2 ( 22.2) 3 2 ( 25.0) 3
Demo 10
You have seen the macro used for two level reporting and one level reporting so the next demonstration you will see is for three-level reporting which is the current limit for %npcttab. I will use AE "intensity" for the lowest level.
/* %npcttab: Demo 10 */ footnote1;
proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcd,uniqueid=patno invid,trtfmt=trtnarr.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv);
by patno invid;
if _dem and _adv;
run;%npcttab(dsin=adv,
total=no,events=yes,
trtlabel=" " "Number of Patients (%) Event Count" " ",
highlvl=amsoc,
highlvllbl=SYSTEM ORGAN CLASS,
midlvl=ampt,
midlvllbl=PREFERRED TERM,
lowlvl=intensity,
lowlvllbl=INTENSITY,
anylowlvl="Any Intensity")And here is the first page of the table it produced.
______________________________________________________________________________
Number of Patients (%) Event Count
SYSTEM ORGAN CLASS Ambident Betamax
PREFERRED TERM (1g/day) (500mg/day)
INTENSITY (N=9) (N=8)
______________________________________________________________________________Gastrointestinal disorders
Constipation
Any Intensity 4 ( 44.4) 8 5 ( 62.5) 7
Severe 2 ( 22.2) 3 3 ( 37.5) 5
Mild 3 ( 33.3) 4 0 ( 0.0) 0
Moderate 1 ( 11.1) 1 2 ( 25.0) 2Nausea
Any Intensity 3 ( 33.3) 3 6 ( 75.0) 6
Severe 0 ( 0.0) 0 5 ( 62.5) 5
Moderate 3 ( 33.3) 3 1 ( 12.5) 1Abdominal pain NOS
Any Intensity 2 ( 22.2) 5 6 ( 75.0) 10
Severe 1 ( 11.1) 1 4 ( 50.0) 5
Mild 2 ( 22.2) 2 2 ( 25.0) 2
Moderate 2 ( 22.2) 2 2 ( 25.0) 3Diarrhoea NOS
Any Intensity 2 ( 22.2) 2 6 ( 75.0) 9
Severe 2 ( 22.2) 2 3 ( 37.5) 3
Mild 0 ( 0.0) 0 2 ( 25.0) 2
Moderate 0 ( 0.0) 0 2 ( 25.0) 4Vomiting NOS
Any Intensity 2 ( 22.2) 3 3 ( 37.5) 3
Mild 1 ( 11.1) 1 2 ( 25.0) 2
Severe 1 ( 11.1) 1 1 ( 12.5) 1
Moderate 1 ( 11.1) 1 0 ( 0.0) 0General disorders and administration site conditions
Chest pain
Any Intensity 5 ( 55.6) 9 4 ( 50.0) 6
Severe 4 ( 44.4) 7 1 ( 12.5) 1
Mild 1 ( 11.1) 1 3 ( 37.5) 4
Moderate 1 ( 11.1) 1 1 ( 12.5) 1Pain NOS
Any Intensity 2 ( 22.2) 3 3 ( 37.5) 3
Mild 1 ( 11.1) 1 1 ( 12.5) 1
Moderate 1 ( 11.1) 1 1 ( 12.5) 1
Severe 1 ( 11.1) 1 1 ( 12.5) 1Psychiatric disorders
Insomnia
Any Intensity 4 ( 44.4) 7 7 ( 87.5) 10
Mild 3 ( 33.3) 4 3 ( 37.5) 3
Severe 2 ( 22.2) 2 4 ( 50.0) 5
Moderate 1 ( 11.1) 1 2 ( 25.0) 2Anxiety
Any Intensity 2 ( 22.2) 2 3 ( 37.5) 6
Moderate 0 ( 0.0) 0 3 ( 37.5) 5
Demo 10b
You might have noticed that the intensity order was not consistent above. We can easily fix that using lowlvlord=intensity to give us the ordering we want. I won't show you the code again but here is the first page of the output with lowlvlord=intensity added as a parameter call.
______________________________________________________________________________
Number of Patients (%) Event Count
SYSTEM ORGAN CLASS Ambident Betamax
PREFERRED TERM (1g/day) (500mg/day)
INTENSITY (N=9) (N=8)
______________________________________________________________________________Gastrointestinal disorders
Constipation
Any Intensity 4 ( 44.4) 8 5 ( 62.5) 7
Mild 3 ( 33.3) 4 0 ( 0.0) 0
Moderate 1 ( 11.1) 1 2 ( 25.0) 2
Severe 2 ( 22.2) 3 3 ( 37.5) 5Nausea
Any Intensity 3 ( 33.3) 3 6 ( 75.0) 6
Moderate 3 ( 33.3) 3 1 ( 12.5) 1
Severe 0 ( 0.0) 0 5 ( 62.5) 5Abdominal pain NOS
Any Intensity 2 ( 22.2) 5 6 ( 75.0) 10
Mild 2 ( 22.2) 2 2 ( 25.0) 2
Moderate 2 ( 22.2) 2 2 ( 25.0) 3
Severe 1 ( 11.1) 1 4 ( 50.0) 5Diarrhoea NOS
Any Intensity 2 ( 22.2) 2 6 ( 75.0) 9
Mild 0 ( 0.0) 0 2 ( 25.0) 2
Moderate 0 ( 0.0) 0 2 ( 25.0) 4
Severe 2 ( 22.2) 2 3 ( 37.5) 3Vomiting NOS
Any Intensity 2 ( 22.2) 3 3 ( 37.5) 3
Mild 1 ( 11.1) 1 2 ( 25.0) 2
Moderate 1 ( 11.1) 1 0 ( 0.0) 0
Severe 1 ( 11.1) 1 1 ( 12.5) 1General disorders and administration site conditions
Chest pain
Any Intensity 5 ( 55.6) 9 4 ( 50.0) 6
Mild 1 ( 11.1) 1 3 ( 37.5) 4
Moderate 1 ( 11.1) 1 1 ( 12.5) 1
Severe 4 ( 44.4) 7 1 ( 12.5) 1Pain NOS
Any Intensity 2 ( 22.2) 3 3 ( 37.5) 3
Mild 1 ( 11.1) 1 1 ( 12.5) 1
Moderate 1 ( 11.1) 1 1 ( 12.5) 1
Severe 1 ( 11.1) 1 1 ( 12.5) 1Psychiatric disorders
Insomnia
Any Intensity 4 ( 44.4) 7 7 ( 87.5) 10
Mild 3 ( 33.3) 4 3 ( 37.5) 3
Moderate 1 ( 11.1) 1 2 ( 25.0) 2
Severe 2 ( 22.2) 2 4 ( 50.0) 5Anxiety
Any Intensity 2 ( 22.2) 2 3 ( 37.5) 6
Mild 1 ( 11.1) 1 1 ( 12.5) 1
Demo 11
Note how in all the above outputs the "System Organ Class" term stretches across the page. This is the standard style. The styles have a number. This is style=1. It stops the system organ class from flowing onto following lines. This is good but it also means we can not show the counts and percentages on that line since it is just a display line. For the totals for all intensities we show this in an "Any Intensity" line. But maybe we would like to show these totals on the same line as the preferred term it belongs to. We can do this using style=3 as you will see. We must use the style3lbl= parameter to give this combined column a label because the labels we used for the style=1 report will be ignored.
/* %npcttab: Demo 11 */ footnote1;
proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcd,uniqueid=patno invid,trtfmt=trtnarr.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv);
by patno invid;
if _dem and _adv;
run;%npcttab(dsin=adv, style=3,
style3lbl="System Organ Class"
" Preferred Term" " Intensity",
total=no,events=yes,
trtlabel=" " "Number of Patients (%) Event Count" " ",
highlvl=amsoc,
midlvl=ampt,
lowlvl=intensity,
lowlvlord=intensity)Here is the first page of the output. Note where the system organ class flows onto the next line there is a "hanging indent" of one space due to the default setting of hindent=1 and you can change this value if you wish, just as you can change the normal indent of the lower terms which by default is indent=3 .
______________________________________________________________________________
Number of Patients (%) Event Count
System Organ Class Ambident Betamax
Preferred Term (1g/day) (500mg/day)
Intensity (N=9) (N=8)
______________________________________________________________________________Gastrointestinal disorders
Constipation 4 ( 44.4) 8 5 ( 62.5) 7
Mild 3 ( 33.3) 4 0 ( 0.0) 0
Moderate 1 ( 11.1) 1 2 ( 25.0) 2
Severe 2 ( 22.2) 3 3 ( 37.5) 5Nausea 3 ( 33.3) 3 6 ( 75.0) 6
Moderate 3 ( 33.3) 3 1 ( 12.5) 1
Severe 0 ( 0.0) 0 5 ( 62.5) 5Abdominal pain NOS 2 ( 22.2) 5 6 ( 75.0) 10
Mild 2 ( 22.2) 2 2 ( 25.0) 2
Moderate 2 ( 22.2) 2 2 ( 25.0) 3
Severe 1 ( 11.1) 1 4 ( 50.0) 5Diarrhoea NOS 2 ( 22.2) 2 6 ( 75.0) 9
Mild 0 ( 0.0) 0 2 ( 25.0) 2
Moderate 0 ( 0.0) 0 2 ( 25.0) 4
Severe 2 ( 22.2) 2 3 ( 37.5) 3Vomiting NOS 2 ( 22.2) 3 3 ( 37.5) 3
Mild 1 ( 11.1) 1 2 ( 25.0) 2
Moderate 1 ( 11.1) 1 0 ( 0.0) 0
Severe 1 ( 11.1) 1 1 ( 12.5) 1General disorders and administration site
conditions
Chest pain 5 ( 55.6) 9 4 ( 50.0) 6
Mild 1 ( 11.1) 1 3 ( 37.5) 4
Moderate 1 ( 11.1) 1 1 ( 12.5) 1
Severe 4 ( 44.4) 7 1 ( 12.5) 1Pain NOS 2 ( 22.2) 3 3 ( 37.5) 3
Mild 1 ( 11.1) 1 1 ( 12.5) 1
Moderate 1 ( 11.1) 1 1 ( 12.5) 1
Severe 1 ( 11.1) 1 1 ( 12.5) 1Psychiatric disorders
Insomnia 4 ( 44.4) 7 7 ( 87.5) 10
Mild 3 ( 33.3) 4 3 ( 37.5) 3
Moderate 1 ( 11.1) 1 2 ( 25.0) 2
Severe 2 ( 22.2) 2 4 ( 50.0) 5Anxiety 2 ( 22.2) 2 3 ( 37.5) 6
Mild 1 ( 11.1) 1 1 ( 12.5) 1
Moderate 0 ( 0.0) 0 3 ( 37.5) 5
Severe 1 ( 11.1) 1 0 ( 0.0) 0Musculoskeletal and connective tissue
disorders
Pain in extremity 3 ( 33.3) 3 5 ( 62.5) 8
Mild 1 ( 11.1) 1 3 ( 37.5) 4
Moderate 1 ( 11.1) 1 1 ( 12.5) 1
Demo 12
You can see from the above output that we have the start of "Musculoskeletal and connective tissue disorders" at the bottom of the page and it continues onto the next page. This is not good so we can force this onto the next page using the pageon= parameter. You make this work you give a list in quotes, separated by spaces, of the start text of the highest level term you want to increment the page count by. Here is the call to the macro again using the pageon= parameter. I will also align the columns headers to the left using the trtalign= parameter to show you some of the flexibilty you have with this macro. You can adjust the alignment, width and spacing of most of what is displayed to give you the best layout. You can learn more about this from reading the macro header when you are done going through the demonstrations on this page.
/* %npcttab: Demo 12 */ footnote1;
proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcd,uniqueid=patno invid,trtfmt=trtnarr.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv);
by patno invid;
if _dem and _adv;
run;%npcttab(dsin=adv, style=3, pageon="Musculo" , trtalign=L,
style3lbl="System Organ Class"
" Preferred Term" " Intensity",
total=no,events=yes,
trtlabel=" " "Number of Patients (%) Event Count" " ",
highlvl=amsoc,
midlvl=ampt,
lowlvl=intensity,
lowlvlord=intensity)
______________________________________________________________________________
Number of Patients (%) Event Count
System Organ Class Ambident Betamax
Preferred Term (1g/day) (500mg/day)
Intensity (N=9) (N=8)
______________________________________________________________________________Gastrointestinal disorders
Constipation 4 ( 44.4) 8 5 ( 62.5) 7
Mild 3 ( 33.3) 4 0 ( 0.0) 0
Moderate 1 ( 11.1) 1 2 ( 25.0) 2
Severe 2 ( 22.2) 3 3 ( 37.5) 5Nausea 3 ( 33.3) 3 6 ( 75.0) 6
Moderate 3 ( 33.3) 3 1 ( 12.5) 1
Severe 0 ( 0.0) 0 5 ( 62.5) 5Abdominal pain NOS 2 ( 22.2) 5 6 ( 75.0) 10
Mild 2 ( 22.2) 2 2 ( 25.0) 2
Moderate 2 ( 22.2) 2 2 ( 25.0) 3
Severe 1 ( 11.1) 1 4 ( 50.0) 5Diarrhoea NOS 2 ( 22.2) 2 6 ( 75.0) 9
Mild 0 ( 0.0) 0 2 ( 25.0) 2
Moderate 0 ( 0.0) 0 2 ( 25.0) 4
Severe 2 ( 22.2) 2 3 ( 37.5) 3Vomiting NOS 2 ( 22.2) 3 3 ( 37.5) 3
Mild 1 ( 11.1) 1 2 ( 25.0) 2
Moderate 1 ( 11.1) 1 0 ( 0.0) 0
Severe 1 ( 11.1) 1 1 ( 12.5) 1General disorders and administration site
conditions
Chest pain 5 ( 55.6) 9 4 ( 50.0) 6
Mild 1 ( 11.1) 1 3 ( 37.5) 4
Moderate 1 ( 11.1) 1 1 ( 12.5) 1
Severe 4 ( 44.4) 7 1 ( 12.5) 1Pain NOS 2 ( 22.2) 3 3 ( 37.5) 3
Mild 1 ( 11.1) 1 1 ( 12.5) 1
Moderate 1 ( 11.1) 1 1 ( 12.5) 1
Severe 1 ( 11.1) 1 1 ( 12.5) 1Psychiatric disorders
Insomnia 4 ( 44.4) 7 7 ( 87.5) 10
Mild 3 ( 33.3) 4 3 ( 37.5) 3
Moderate 1 ( 11.1) 1 2 ( 25.0) 2
Severe 2 ( 22.2) 2 4 ( 50.0) 5Anxiety 2 ( 22.2) 2 3 ( 37.5) 6
Mild 1 ( 11.1) 1 1 ( 12.5) 1
Moderate 0 ( 0.0) 0 3 ( 37.5) 5
Severe 1 ( 11.1) 1 0 ( 0.0) 0
______________________________________________________________________________
Number of Patients (%) Event Count
System Organ Class Ambident Betamax
Preferred Term (1g/day) (500mg/day)
Intensity (N=9) (N=8)
______________________________________________________________________________Musculoskeletal and connective tissue
disorders
Pain in extremity 3 ( 33.3) 3 5 ( 62.5) 8
Mild 1 ( 11.1) 1 3 ( 37.5) 4
Moderate 1 ( 11.1) 1 1 ( 12.5) 1
Severe 1 ( 11.1) 1 3 ( 37.5) 3Back pain 3 ( 33.3) 4 4 ( 50.0) 6
Mild 1 ( 11.1) 1 2 ( 25.0) 2
Moderate 2 ( 22.2) 3 3 ( 37.5) 4Respiratory, thoracic and mediastinal
disorders
Cough 4 ( 44.4) 7 4 ( 50.0) 5
Mild 1 ( 11.1) 1 1 ( 12.5) 1
Moderate 2 ( 22.2) 3 3 ( 37.5) 4
Severe 3 ( 33.3) 3 0 ( 0.0) 0Dyspnoea 3 ( 33.3) 6 3 ( 37.5) 4
Mild 1 ( 11.1) 1 2 ( 25.0) 2
Moderate 2 ( 22.2) 2 1 ( 12.5) 1
Severe 3 ( 33.3) 3 1 ( 12.5) 1Vascular disorders
Hypotension NOS 4 ( 44.4) 7 5 ( 62.5) 9
Mild 2 ( 22.2) 4 4 ( 50.0) 6
Moderate 2 ( 22.2) 2 1 ( 12.5) 1
Severe 1 ( 11.1) 1 2 ( 25.0) 2Hypertension NOS 2 ( 22.2) 6 2 ( 25.0) 4
Mild 1 ( 11.1) 2 1 ( 12.5) 2
Moderate 2 ( 22.2) 3 0 ( 0.0) 0
Severe 1 ( 11.1) 1 1 ( 12.5) 2Nervous system disorders
Headache 2 ( 22.2) 4 5 ( 62.5) 12
Mild 0 ( 0.0) 0 2 ( 25.0) 2
Moderate 2 ( 22.2) 3 2 ( 25.0) 3
Severe 1 ( 11.1) 1 4 ( 50.0) 7Tremor 2 ( 22.2) 3 2 ( 25.0) 3
Mild 2 ( 22.2) 2 2 ( 25.0) 2
Moderate 1 ( 11.1) 1 0 ( 0.0) 0
Severe 0 ( 0.0) 0 1 ( 12.5) 1
Demo 13
Looking at the above two page table then we can see we are missing the "Mild" term for "Nausea" on the first page and the "Severe" term for "Back pain" on the second page. There is nothing wrong, it just wasn't in the data, but it might be nice to show it as zeroes in these two cases. This can be done using the alllowlvl=yes parameter setting and then it would find out all the terms at the lowest level and show those for every mid level term and it would solcve out problem. Using this parameter actually uses the dsall= parameter which is a dataset that forces all the terms to be shown. If this dataset just contains low level terms then the macro will add the high and mid level terms from the input data so by specifying a simple "intensity" dsall dataset we can force the three intensity terms to be shown in all cases. This might be better than using alllowlvl=yes when they are only a few AEs because all the intensities you want to report might not be present in the data.
/* %npcttab: Demo 13 */ footnote1;
proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcd,uniqueid=patno invid,trtfmt=trtnarr.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv);
by patno invid;
if _dem and _adv;
run;data intensity;
intensity=1;output;
intensity=2;output;
intensity=3;output;
run;%npcttab(dsin=adv, style=3, pageon="Musculo" , trtalign=L, dsall=intensity,
style3lbl="System Organ Class"
" Preferred Term" " Intensity",
total=no,events=yes,
trtlabel=" " "Number of Patients (%) Event Count" " ",
highlvl=amsoc,
midlvl=ampt,
lowlvl=intensity,
lowlvlord=intensity)The missing intensities for "Nausea" on the first page and "Back pain" on the second page are now shown as zeroes.
______________________________________________________________________________
Number of Patients (%) Event Count
System Organ Class Ambident Betamax
Preferred Term (1g/day) (500mg/day)
Intensity (N=9) (N=8)
______________________________________________________________________________Gastrointestinal disorders
Constipation 4 ( 44.4) 8 5 ( 62.5) 7
Mild 3 ( 33.3) 4 0 ( 0.0) 0
Moderate 1 ( 11.1) 1 2 ( 25.0) 2
Severe 2 ( 22.2) 3 3 ( 37.5) 5Nausea 3 ( 33.3) 3 6 ( 75.0) 6
Mild 0 ( 0.0) 0 0 ( 0.0) 0
Moderate 3 ( 33.3) 3 1 ( 12.5) 1
Severe 0 ( 0.0) 0 5 ( 62.5) 5Abdominal pain NOS 2 ( 22.2) 5 6 ( 75.0) 10
Mild 2 ( 22.2) 2 2 ( 25.0) 2
Moderate 2 ( 22.2) 2 2 ( 25.0) 3
Severe 1 ( 11.1) 1 4 ( 50.0) 5Diarrhoea NOS 2 ( 22.2) 2 6 ( 75.0) 9
Mild 0 ( 0.0) 0 2 ( 25.0) 2
Moderate 0 ( 0.0) 0 2 ( 25.0) 4
Severe 2 ( 22.2) 2 3 ( 37.5) 3Vomiting NOS 2 ( 22.2) 3 3 ( 37.5) 3
Mild 1 ( 11.1) 1 2 ( 25.0) 2
Moderate 1 ( 11.1) 1 0 ( 0.0) 0
Severe 1 ( 11.1) 1 1 ( 12.5) 1General disorders and administration site
conditions
Chest pain 5 ( 55.6) 9 4 ( 50.0) 6
Mild 1 ( 11.1) 1 3 ( 37.5) 4
Moderate 1 ( 11.1) 1 1 ( 12.5) 1
Severe 4 ( 44.4) 7 1 ( 12.5) 1Pain NOS 2 ( 22.2) 3 3 ( 37.5) 3
Mild 1 ( 11.1) 1 1 ( 12.5) 1
Moderate 1 ( 11.1) 1 1 ( 12.5) 1
Severe 1 ( 11.1) 1 1 ( 12.5) 1Psychiatric disorders
Insomnia 4 ( 44.4) 7 7 ( 87.5) 10
Mild 3 ( 33.3) 4 3 ( 37.5) 3
Moderate 1 ( 11.1) 1 2 ( 25.0) 2
Severe 2 ( 22.2) 2 4 ( 50.0) 5Anxiety 2 ( 22.2) 2 3 ( 37.5) 6
Mild 1 ( 11.1) 1 1 ( 12.5) 1
Moderate 0 ( 0.0) 0 3 ( 37.5) 5
Severe 1 ( 11.1) 1 0 ( 0.0) 0
______________________________________________________________________________
Number of Patients (%) Event Count
System Organ Class Ambident Betamax
Preferred Term (1g/day) (500mg/day)
Intensity (N=9) (N=8)
______________________________________________________________________________Musculoskeletal and connective tissue
disorders
Pain in extremity 3 ( 33.3) 3 5 ( 62.5) 8
Mild 1 ( 11.1) 1 3 ( 37.5) 4
Moderate 1 ( 11.1) 1 1 ( 12.5) 1
Severe 1 ( 11.1) 1 3 ( 37.5) 3Back pain 3 ( 33.3) 4 4 ( 50.0) 6
Mild 1 ( 11.1) 1 2 ( 25.0) 2
Moderate 2 ( 22.2) 3 3 ( 37.5) 4
Severe 0 ( 0.0) 0 0 ( 0.0) 0Respiratory, thoracic and mediastinal
disorders
Cough 4 ( 44.4) 7 4 ( 50.0) 5
Mild 1 ( 11.1) 1 1 ( 12.5) 1
Moderate 2 ( 22.2) 3 3 ( 37.5) 4
Severe 3 ( 33.3) 3 0 ( 0.0) 0Dyspnoea 3 ( 33.3) 6 3 ( 37.5) 4
Mild 1 ( 11.1) 1 2 ( 25.0) 2
Moderate 2 ( 22.2) 2 1 ( 12.5) 1
Severe 3 ( 33.3) 3 1 ( 12.5) 1Vascular disorders
Hypotension NOS 4 ( 44.4) 7 5 ( 62.5) 9
Mild 2 ( 22.2) 4 4 ( 50.0) 6
Moderate 2 ( 22.2) 2 1 ( 12.5) 1
Severe 1 ( 11.1) 1 2 ( 25.0) 2Hypertension NOS 2 ( 22.2) 6 2 ( 25.0) 4
Mild 1 ( 11.1) 2 1 ( 12.5) 2
Moderate 2 ( 22.2) 3 0 ( 0.0) 0
Severe 1 ( 11.1) 1 1 ( 12.5) 2Nervous system disorders
Headache 2 ( 22.2) 4 5 ( 62.5) 12
Mild 0 ( 0.0) 0 2 ( 25.0) 2
Moderate 2 ( 22.2) 3 2 ( 25.0) 3
Severe 1 ( 11.1) 1 4 ( 50.0) 7Tremor 2 ( 22.2) 3 2 ( 25.0) 3
Mild 2 ( 22.2) 2 2 ( 25.0) 2
Moderate 1 ( 11.1) 1 0 ( 0.0) 0
Severe 0 ( 0.0) 0 1 ( 12.5) 1
Demo 14
The dsall= paramter is a very important one so I will show you a more typical example of the way you would normally use it which is to show AEs with zero counts even if they did not happen. This allows you to compare important AEs for different treatment arms or different time periods and see them all listed even if they did not occur. By default, all AEs are shown as well as the ones you specify but if you set the parameter dsallonly=yes then only the ones in the dsall dataset are shown.Here is the code again but I have specified a high and mid level term in the dsall dataset and I have set dsallonly=yes so that I just see these terms.
/* %npcttab: Demo 14 */ footnote1;
proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcd,uniqueid=patno invid,trtfmt=trtnarr.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv);
by patno invid;
if _dem and _adv;
run;data intensity;
length amsoc ampt $ 60;
amsoc="Gastrointestinal disorders";
ampt="Nausea";
intensity=1;output;
intensity=2;output;
intensity=3;output;
run;%npcttab(dsin=adv, style=3, pageon="Musculo" , trtalign=L, dsall=intensity, dsallonly=yes,
style3lbl="System Organ Class"
" Preferred Term" " Intensity",
total=no,events=yes,
trtlabel=" " "Number of Patients (%) Event Count" " ",
highlvl=amsoc,
midlvl=ampt,
lowlvl=intensity,
lowlvlord=intensity)
______________________________________________________________________________
Number of Patients (%) Event Count
System Organ Class Ambident Betamax
Preferred Term (1g/day) (500mg/day)
Intensity (N=9) (N=8)
______________________________________________________________________________Gastrointestinal disorders
Nausea 3 ( 33.3) 3 6 ( 75.0) 6
Mild 0 ( 0.0) 0 0 ( 0.0) 0
Moderate 3 ( 33.3) 3 1 ( 12.5) 1
Severe 0 ( 0.0) 0 5 ( 62.5) 5
ISS Reporting
We now come to a very important topic and that is "Integrated Summary of Safety" reporting. It is important because this is increasingly a requirement where a drug has been used for multiple studies and perhaps multiple indications. The analysis of the safety aspects of the accumulated data from many studies can give a clear indication of the safety or otherwise of the drug and regulatory authorities are demanding to see an analysis of this. If you are reading this page then it is likely that you are looking for a tool to allow you to do ISS reporting and that you already have in-house reporting macros but they are unsuitable for ISS reporting. You are maybe contemplating using this macro and wondering whether it can fulfil your needs in an easy-to-use way. It can! You will see examples and be given an easy entry into this topic. But first, you have to change the way you think about treatment arms. You already know that patients in a study have a treatment arm variable that say what drug (and perhaps dose) they took or if they were assigned to placebo. You are used to the idea of one study one treatment arm. But you have to change this way of thinking to get the best out of these macros. These macro are written with multiple treatment arms in mind. You can think of the extra ones as derived treatment arms.Take a look at the previous code member. You will see that there is always a call to %popfmt before the call to %npcttab. You tell %popfmt what the treatment arm is as the second positional parameter and you tell it what treatment arm format to use. This is not something that is fixed. It is not fixed because it is intended to be flexible. You are expected to have more than one treatment arm if you are using these macros. It is this flexibility that makes these macro very suitable for ISS reporting. You won't see it yet but I will show you what I mean where we have a derived treatment variable based on gender. Once you see how it works with one derived treatment variable you will be able to grasp how it works for ISS reporting.
In the demog dataset I have set up a derived treatment arm named trtsex that takes the main treatment arm and derives another variable based on gender. You can see the way it is derived here:
*- set up the gender-derived treatment arm -;
*- with males shown after females -;
trtsex=trtcd;
if sexcd=1 then trtsex=trtcd+10;And the format to go with it is here:
*- 1-9 = Female, 11-19 = Male -;
value trtsex
1="Ambident@(1g/day)"
2="Betamax@(500mg/day)"
9="Total"
11="Ambident@(1g/day)"
12="Betamax@(500mg/day)"
19="Total"
;Note that I have left gaps in the numbering. That is in case totals are required for each gender group. %npcttab gives you totals by default but it can not do so for groups. It only gives the one overall total. If you need group totals then you have to do it another way but it is easy enough to do and you will be shown how to do it.
Demo 15
Continuing with the dialog in the previous section you will now see the derived treatment arm used that splits by gender. We have to group the treatment arm values and supply suitable labels and we will use the trtvarlist= parameter to supply these labels.
/* %npcttab: Demo 15 */ options ls=80;
footnote1;proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtsex,uniqueid=patno invid,trtfmt=trtsex.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtsex) adv(in=_adv);
by patno invid;
if _dem and _adv;
run;%npcttab(dsin=adv, style=3, trtspace=2, pageon="Muscu", trtalign=L,
style3lbl="System Organ Class"
" Preferred Term" " Intensity",
trtlabel="Number of Patients (%)" " ",
trtvarlist=("__Female__" TRT1 TRT2) ("__Male__" TRT11 TRT12),
total=no,
highlvl=amsoc,
midlvl=ampt,
lowlvl=intensity,
lowlvlord=intensity)And here is the output with the results for "Female" shown before "Male":
________________________________________________________________________________ Number of Patients (%)
_________Female_________ __________Male__________
System Organ Class Ambident Betamax Ambident Betamax
Preferred Term (1g/day) (500mg/day) (1g/day) (500mg/day)
Intensity (N=5) (N=5) (N=4) (N=3)
________________________________________________________________________________Gastrointestinal disorders
Constipation 1 ( 20.0) 2 ( 40.0) 3 ( 75.0) 3 (100.0)
Mild 1 ( 20.0) 0 ( 0.0) 2 ( 50.0) 0 ( 0.0)
Moderate 0 ( 0.0) 1 ( 20.0) 1 ( 25.0) 1 ( 33.3)
Severe 0 ( 0.0) 1 ( 20.0) 2 ( 50.0) 2 ( 66.7)Nausea 1 ( 20.0) 4 ( 80.0) 2 ( 50.0) 2 ( 66.7)
Moderate 1 ( 20.0) 1 ( 20.0) 2 ( 50.0) 0 ( 0.0)
Severe 0 ( 0.0) 3 ( 60.0) 0 ( 0.0) 2 ( 66.7)Abdominal pain NOS 1 ( 20.0) 3 ( 60.0) 1 ( 25.0) 3 (100.0)
Mild 1 ( 20.0) 1 ( 20.0) 1 ( 25.0) 1 ( 33.3)
Moderate 1 ( 20.0) 0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0) 3 (100.0)
Mild 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 1 ( 33.3)
Moderate 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 3 (100.0)
Severe 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 0 ( 0.0)
________________________________________________________________________________
Number of Patients (%)
_________Female_________ __________Male__________
System Organ Class Ambident Betamax Ambident Betamax
Preferred Term (1g/day) (500mg/day) (1g/day) (500mg/day)
Intensity (N=5) (N=5) (N=4) (N=3)
________________________________________________________________________________Musculoskeletal and
connective tissue disorders
Pain in extremity 1 ( 20.0) 2 ( 40.0) 2 ( 50.0) 3 (100.0)
Mild 0 ( 0.0) 1 ( 20.0) 1 ( 25.0) 2 ( 66.7)
Moderate 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 1 ( 33.3)
Severe 1 ( 20.0) 1 ( 20.0) 0 ( 0.0) 2 ( 66.7)Back pain 0 ( 0.0) 3 ( 60.0) 3 ( 75.0) 1 ( 33.3)
Mild 0 ( 0.0) 2 ( 40.0) 1 ( 25.0) 0 ( 0.0)
Moderate 0 ( 0.0) 2 ( 40.0) 2 ( 50.0) 1 ( 33.3)Respiratory, thoracic and
mediastinal disorders
Cough 1 ( 20.0) 2 ( 40.0) 3 ( 75.0) 2 ( 66.7)
Mild 1 ( 20.0) 1 ( 20.0) 0 ( 0.0) 0 ( 0.0)
Moderate 1 ( 20.0) 1 ( 20.0) 1 ( 25.0) 2 ( 66.7)
Severe 1 ( 20.0) 0 ( 0.0) 2 ( 50.0) 0 ( 0.0)Dyspnoea 1 ( 20.0) 1 ( 20.0) 2 ( 50.0) 2 ( 66.7)
Mild 0 ( 0.0) 1 ( 20.0) 1 ( 25.0) 1 ( 33.3)
Moderate 0 ( 0.0) 0 ( 0.0) 2 ( 50.0) 1 ( 33.3)
Severe 1 ( 20.0) 0 ( 0.0) 2 ( 50.0) 1 ( 33.3)Vascular disorders
Hypotension NOS 1 ( 20.0) 3 ( 60.0) 3 ( 75.0) 2 ( 66.7)
Mild 0 ( 0.0) 3 ( 60.0) 2 ( 50.0) 1 ( 33.3)
Moderate 1 ( 20.0) 0 ( 0.0) 1 ( 25.0) 1 ( 33.3)
Severe 0 ( 0.0) 1 ( 20.0) 1 ( 25.0) 1 ( 33.3)Hypertension NOS 0 ( 0.0) 2 ( 40.0) 2 ( 50.0) 0 ( 0.0)
Mild 0 ( 0.0) 1 ( 20.0) 1 ( 25.0) 0 ( 0.0)
Moderate 0 ( 0.0) 0 ( 0.0) 2 ( 50.0) 0 ( 0.0)
Severe 0 ( 0.0) 1 ( 20.0) 1 ( 25.0) 0 ( 0.0)Nervous system disorders
Headache 0 ( 0.0) 3 ( 60.0) 2 ( 50.0) 2 ( 66.7)
Mild 0 ( 0.0) 2 ( 40.0) 0 ( 0.0) 0 ( 0.0)
Moderate 0 ( 0.0) 1 ( 20.0) 2 ( 50.0) 1 ( 33.3)
Severe 0 ( 0.0) 3 ( 60.0) 1 ( 25.0) 1 ( 33.3)Tremor 0 ( 0.0) 1 ( 20.0) 2 ( 50.0) 1 ( 33.3)
Mild 0 ( 0.0) 1 ( 20.0) 2 ( 50.0) 1 ( 33.3)
Moderate 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 0 ( 0.0)
Severe 0 ( 0.0) 1 ( 20.0) 0 ( 0.0) 0 ( 0.0)
Demo 16
I stated in the last section that I had left gaps for the totals. I can not assign these values in the demog dataset because for this derived treatment arm I can only have one value per patient. If I want to show totals I have to set this up in the data to duplicate them and give them the value of the total. This is easy enough to do as you will see. Note that the creation of the adv2 dataset is done in a separate data step. The two data steps can not be combined into one because the total treatment code would persist for the "patno invid" merge after the first match.
/* %npcttab: Demo 16 */ options ls=100;
footnote1;proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;data demog2;
set demog;
output;
if trtsex<10 then trtsex=9;
else trtsex=19;
output;
run;%popfmt(demog2,trtsex,uniqueid=patno invid,trtfmt=trtsex.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;*- I have to do this in two data steps.... -;
data adv;
merge demog(in=_dem keep=patno invid trtsex) adv(in=_adv);
by patno invid;
if _dem and _adv;
run;*- ... otherwise the "total" arm value gets merged by patid invid -;
data adv2;
set adv;
output;
if trtsex<10 then trtsex=9;
else trtsex=19;
output;
run;%npcttab(dsin=adv2, style=3, trtspace=2, pageon="Muscu", trtalign=L,
style3lbl="System Organ Class"
" Preferred Term" " Intensity",
trtlabel="Number of Patients (%)" " ",
trtvarlist=("__Female__" TRT1 TRT2 TRT9) ("__Male__" TRT11 TRT12 TRT19),
total=no,
highlvl=amsoc,
midlvl=ampt,
lowlvl=intensity,
lowlvlord=intensity)And here is the output showing the totals for "Female" and "Male".
____________________________________________________________________________________________________ Number of Patients (%)
_______________Female________________ ________________Male_________________
System Organ Class Ambident Betamax Ambident Betamax
Preferred Term (1g/day) (500mg/day) Total (1g/day) (500mg/day) Total
Intensity (N=5) (N=5) (N=10) (N=4) (N=3) (N=7)
____________________________________________________________________________________________________Gastrointestinal
disorders
Constipation 1 ( 20.0) 2 ( 40.0) 3 ( 30.0) 3 ( 75.0) 3 (100.0) 6 ( 85.7)
Mild 1 ( 20.0) 0 ( 0.0) 1 ( 10.0) 2 ( 50.0) 0 ( 0.0) 2 ( 28.6)
Moderate 0 ( 0.0) 1 ( 20.0) 1 ( 10.0) 1 ( 25.0) 1 ( 33.3) 2 ( 28.6)
Severe 0 ( 0.0) 1 ( 20.0) 1 ( 10.0) 2 ( 50.0) 2 ( 66.7) 4 ( 57.1)Nausea 1 ( 20.0) 4 ( 80.0) 5 ( 50.0) 2 ( 50.0) 2 ( 66.7) 4 ( 57.1)
Moderate 1 ( 20.0) 1 ( 20.0) 2 ( 20.0) 2 ( 50.0) 0 ( 0.0) 2 ( 28.6)
Severe 0 ( 0.0) 3 ( 60.0) 3 ( 30.0) 0 ( 0.0) 2 ( 66.7) 2 ( 28.6)Abdominal pain NOS 1 ( 20.0) 3 ( 60.0) 4 ( 40.0) 1 ( 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.0) 1 ( 20.0) 1 ( 10.0) 2 ( 50.0) 2 ( 66.7) 4 ( 57.1)
Mild 0 ( 0.0) 1 ( 20.0) 1 ( 10.0) 1 ( 25.0) 0 ( 0.0) 1 ( 14.3)
Moderate 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 1 ( 33.3) 2 ( 28.6)
Severe 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 1 ( 33.3) 2 ( 28.6)Psychiatric disorders
Insomnia 0 ( 0.0) 4 ( 80.0) 4 ( 40.0) 4 (100.0) 3 (100.0) 7 (100.0)
Mild 0 ( 0.0) 1 ( 20.0) 1 ( 10.0) 3 ( 75.0) 2 ( 66.7) 5 ( 71.4)
Moderate 0 ( 0.0) 2 ( 40.0) 2 ( 20.0) 1 ( 25.0) 0 ( 0.0) 1 ( 14.3)
Severe 0 ( 0.0) 3 ( 60.0) 3 ( 30.0) 2 ( 50.0) 1 ( 33.3) 3 ( 42.9)Anxiety 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 2 ( 50.0) 3 (100.0) 5 ( 71.4)
Mild 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 1 ( 33.3) 2 ( 28.6)
Moderate 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 3 (100.0) 3 ( 42.9)
Severe 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 0 ( 0.0) 1 ( 14.3)
____________________________________________________________________________________________________
Number of Patients (%)
_______________Female________________ ________________Male_________________
System Organ Class Ambident Betamax Ambident Betamax
Preferred Term (1g/day) (500mg/day) Total (1g/day) (500mg/day) Total
Intensity (N=5) (N=5) (N=10) (N=4) (N=3) (N=7)
____________________________________________________________________________________________________Musculoskeletal and
connective tissue
disorders
Pain in extremity 1 ( 20.0) 2 ( 40.0) 3 ( 30.0) 2 ( 50.0) 3 (100.0) 5 ( 71.4)
Mild 0 ( 0.0) 1 ( 20.0) 1 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.3) 3 ( 42.9)
Moderate 1 ( 20.0) 0 ( 0.0) 1 ( 10.0) 1 ( 25.0) 1 ( 33.3) 2 ( 28.6)
Severe 0 ( 0.0) 1 ( 20.0) 1 ( 10.0) 1 ( 25.0) 1 ( 33.3) 2 ( 28.6)Hypertension NOS 0 ( 0.0) 2 ( 40.0) 2 ( 20.0) 2 ( 50.0) 0 ( 0.0) 2 ( 28.6)
Mild 0 ( 0.0) 1 ( 20.0) 1 ( 10.0) 1 ( 25.0) 0 ( 0.0) 1 ( 14.3)
Moderate 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 2 ( 50.0) 0 ( 0.0) 2 ( 28.6)
Severe 0 ( 0.0) 1 ( 20.0) 1 ( 10.0) 1 ( 25.0) 0 ( 0.0) 1 ( 14.3)Nervous system
disorders
Headache 0 ( 0.0) 3 ( 60.0) 3 ( 30.0) 2 ( 50.0) 2 ( 66.7) 4 ( 57.1)
Mild 0 ( 0.0) 2 ( 40.0) 2 ( 20.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0)
Moderate 0 ( 0.0) 1 ( 20.0) 1 ( 10.0) 2 ( 50.0) 1 ( 33.3) 3 ( 42.9)
Severe 0 ( 0.0) 3 ( 60.0) 3 ( 30.0) 1 ( 25.0) 1 ( 33.3) 2 ( 28.6)Tremor 0 ( 0.0) 1 ( 20.0) 1 ( 10.0) 2 ( 50.0) 1 ( 33.3) 3 ( 42.9)
Mild 0 ( 0.0) 1 ( 20.0) 1 ( 10.0) 2 ( 50.0) 1 ( 33.3) 3 ( 42.9)
Moderate 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 0 ( 0.0) 1 ( 14.3)
Severe 0 ( 0.0) 1 ( 20.0) 1 ( 10.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0)
Demo 17
You have seen how you can use a derived treatment arm in the above case to split analysis by gender but you may not be able to see what this has to do with pooled analysis. I will now explain. Think of "gender" as your study groupings. Suppose you had studies 101 and 102 and you wanted to group them and you had studies 301 and 302 and you wanted them in another group then that would be like your "Female" and "Male" grouping, except you could have more than two groups if you were grouping by more studies. Suppose you were grouping by several studies and you wanted to show different groups of studies compared then you could have a whole set of derived treatment arm variables like trtcomb1, trtcomb2, trtcomb3 etc. that have non-missing values for the patients you want to group and have gaps in the numberings for the "Total" of the study groupings just like I did with gender above.The next demo is just like the split by gender but without the totals. I have a treatment arm named trtcdx with a format as follows which is also defined at the top of this page.
proc format;
*- 1-9 = study 101+102, 11-19 = study 301+302 -;
value trtcdx
1="Placebo"
2="Drug A"
3="Drug B"
9="Total"
11="Placebo"
12="Drug A"
13="Drug B"
19="Total"
;
run;
/* %npcttab: Demo 17 */ options ls=120;
footnote1;proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;%popfmt(demog,trtcdx,uniqueid=patno invid,trtfmt=trtcdx.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcdx) adv(in=_adv);
by patno invid;
if _dem and _adv;
run;%npcttab(dsin=adv, style=3, trtspace=2, pageon="Muscu", trtalign=L,
style3lbl="System Organ Class"
" Preferred Term" " Intensity",
trtlabel="Number of Patients (%)" " ",
trtvarlist=("__Study 101+102__" TRT1 TRT2 TRT3) ("__Study 301+302__" TRT11 TRT12 TRT13),
total=no,
highlvl=amsoc,
midlvl=ampt,
lowlvl=intensity,
lowlvlord=intensity)Here is the output.
________________________________________________________________________________________________________________________ Number of Patients (%)
System Organ Class ____________Study 101+102____________ ____________Study 301+302____________
Preferred Term Placebo Drug A Drug B Placebo Drug A Drug B
Intensity (N=4) (N=3) (N=2) (N=1) (N=3) (N=4)
________________________________________________________________________________________________________________________Gastrointestinal disorders
Constipation 2 ( 50.0) 1 ( 33.3) 2 (100.0) 1 (100.0) 2 ( 66.7) 1 ( 25.0)
Mild 0 ( 0.0) 0 ( 0.0) 1 ( 50.0) 1 (100.0) 0 ( 0.0) 1 ( 25.0)
Moderate 1 ( 25.0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.0) 1 ( 33.3) 0 ( 0.0)
Severe 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0)
________________________________________________________________________________________________________________________
Number of Patients (%)
System Organ Class ____________Study 101+102____________ ____________Study 301+302____________
Preferred Term Placebo Drug A Drug B Placebo Drug A Drug B
Intensity (N=4) (N=3) (N=2) (N=1) (N=3) (N=4)
________________________________________________________________________________________________________________________Musculoskeletal and connective tissue
disorders
Pain in extremity 0 ( 0.0) 2 ( 66.7) 2 (100.0) 0 ( 0.0) 2 ( 66.7) 2 ( 50.0)
Mild 0 ( 0.0) 2 ( 66.7) 1 ( 50.0) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0)
Moderate 0 ( 0.0) 1 ( 33.3) 1 ( 50.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0)
Severe 0 ( 0.0) 0 ( 0.0) 1 ( 50.0) 0 ( 0.0) 2 ( 66.7) 1 ( 25.0)Back pain 1 ( 25.0) 1 ( 33.3) 2 (100.0) 0 ( 0.0) 1 ( 33.3) 2 ( 50.0)
Mild 1 ( 25.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 2 ( 50.0)
Moderate 0 ( 0.0) 1 ( 33.3) 2 (100.0) 0 ( 0.0) 1 ( 33.3) 1 ( 25.0)Respiratory, thoracic and mediastinal
disorders
Cough 2 ( 50.0) 2 ( 66.7) 2 (100.0) 1 (100.0) 0 ( 0.0) 1 ( 25.0)
Mild 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 1 (100.0) 0 ( 0.0) 1 ( 25.0)
Moderate 1 ( 25.0) 1 ( 33.3) 2 (100.0) 1 (100.0) 0 ( 0.0) 0 ( 0.0)
Severe 1 ( 25.0) 1 ( 33.3) 0 ( 0.0) 1 (100.0) 0 ( 0.0) 0 ( 0.0)Dyspnoea 2 ( 50.0) 1 ( 33.3) 2 (100.0) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0)
M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 0.0) 1 ( 25.0)
Mild 1 ( 25.0) 1 ( 33.3) 1 ( 50.0) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0)
Moderate 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0)
Severe 1 ( 25.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0)
Demo 18
I have left room for the "Total" treatment arm for each study grouping so now you will see the same with the generated totals in the code as was done for gender. You can have as many study groupings as you want with as many treatment arms as you need and generate totals for the groups if you need to. In a big pooling analysis just generate as many treatment arms as you need along the same lines and your pooled analysis will be one of the easiest pieces of coding you have ever written. By design, these macros are perfect for this sort of analysis.Did you notice that the two pooled studies did not have much of a gap between them? I can adjust that using trtsp5=4 to put 4 spaces before the 5th treatment column (which is the start column of the second study grouping). You can adjust other things like the percentage format, whether the percent sign is shown and for ISS reporting you will probably need to set nlen=4 so that there are 4 digits for the "n" value otherwise you will see 1E3 for 1000.
/* %npcttab: Demo 18 */ options ls=130;
footnote1;proc sort data=sasuser.demog(where=(fascd=1))
out=demog(drop=fascd);
by patno invid;
run;data demog2;
set demog;
output;
if trtcdx<10 then trtcdx=9;
else trtcdx=19;
output;
run;%popfmt(demog2,trtcdx,uniqueid=patno invid,trtfmt=trtcdx.)
proc sort data=sasuser.adv
out=adv;
by patno invid;
run;data adv;
merge demog(in=_dem keep=patno invid trtcdx) adv(in=_adv);
by patno invid;
if _dem and _adv;
run;data adv2;
set adv;
output;
if trtcdx<10 then trtcdx=9;
else trtcdx=19;
output;
run;%npcttab(dsin=adv2, style=3, trtspace=2, pageon="Muscu", trtalign=L, trtsp5=4,
style3lbl="System Organ Class"
" Preferred Term" " Intensity",
trtlabel="Number of Patients (%)" " ",
trtvarlist=("__Study 101+102__" TRT1 TRT2 TRT3 TRT9) ("__Study 301+302__" TRT11 TRT12 TRT13 TRT19),
total=no,
highlvl=amsoc,
midlvl=ampt,
lowlvl=intensity,
lowlvlord=intensity)
__________________________________________________________________________________________________________________________________ Number of Patients (%)
System Organ Class __________________Study 101+102___________________ __________________Study 301+302___________________
Preferred Term Placebo Drug A Drug B Total Placebo Drug A Drug B Total
Intensity (N=4) (N=3) (N=2) (N=9) (N=1) (N=3) (N=4) (N=8)
__________________________________________________________________________________________________________________________________Gastrointestinal
disorders
Constipation 2 ( 50.0) 1 ( 33.3) 2 (100.0) 5 ( 55.6) 1 (100.0) 2 ( 66.7) 1 ( 25.0) 4 ( 50.0)
Mild 0 ( 0.0) 0 ( 0.0) 1 ( 50.0) 1 ( 11.1) 1 (100.0) 0 ( 0.0) 1 ( 25.0) 2 ( 25.0)
Moderate 1 ( 25.0) 0 ( 0.0) 1 ( 50.0) 2 ( 22.2) 0 ( 0.0) 1 ( 33.3) 0 ( 0.0) 1 ( 12.5)
Severe 1 ( 25.0) 1 ( 33.3) 1 ( 50.0) 3 ( 33.3) 0 ( 0.0) 1 ( 33.3) 1 ( 25.0) 2 ( 25.0)Nausea 3 ( 75.0) 2 ( 66.7) 1 ( 50.0) 6 ( 66.7) 0 ( 0.0) 1 ( 33.3) 2 ( 50.0) 3 ( 37.5)
Moderate 2 ( 50.0) 1 ( 33.3) 0 ( 0.0) 3 ( 33.3) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 1 ( 12.5)
Severe 1 ( 25.0) 1 ( 33.3) 1 ( 50.0) 3 ( 33.3) 0 ( 0.0) 1 ( 33.3) 1 ( 25.0) 2 ( 25.0)Abdominal pain NOS 1 ( 25.0) 1 ( 33.3) 1 ( 50.0) 3 ( 33.3) 0 ( 0.0) 2 ( 66.7) 3 ( 75.0) 5 ( 62.5)
Mild 1 ( 25.0) 0 ( 0.0) 0 ( 0.0) 1 ( 11.1) 0 ( 0.0) 1 ( 33.3) 2 ( 50.0) 3 ( 37.5)
Moderate 0 ( 0.0) 1 ( 33.3) 1 ( 50.0) 2 ( 22.2) 0 ( 0.0) 0 ( 0.0) 2 ( 50.0) 2 ( 25.0)
Sever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 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 1 ( 12.5)
__________________________________________________________________________________________________________________________________
Number of Patients (%)
System Organ Class __________________Study 101+102___________________ __________________Study 301+302___________________
Preferred Term Placebo Drug A Drug B Total Placebo Drug A Drug B Total
Intensity (N=4) (N=3) (N=2) (N=9) (N=1) (N=3) (N=4) (N=8)
__________________________________________________________________________________________________________________________________Musculoskeletal and
connective tissue
disorders
Pain in extremity 0 ( 0.0) 2 ( 66.7) 2 (100.0) 4 ( 44.4) 0 ( 0.0) 2 ( 66.7) 2 ( 50.0) 4 ( 50.0)
Mild 0 ( 0.0) 2 ( 66.7) 1 ( 50.0) 3 ( 33.3) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 1 ( 12.5)
Moderate 0 ( 0.0) 1 ( 33.3) 1 ( 50.0) 2 ( 22.2) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0)
Severe 0 ( 0.0) 0 ( 0.0) 1 ( 50.0) 1 ( 11.1) 0 ( 0.0) 2 ( 66.7) 1 ( 25.0) 3 ( 37.5)Back pain 1 ( 25.0) 1 ( 33.3) 2 (100.0) 4 ( 44.4) 0 ( 0.0) 1 ( 33.3) 2 ( 50.0) 3 ( 37.5)
Mild 1 ( 25.0) 0 ( 0.0) 0 ( 0.0) 1 ( 11.1) 0 ( 0.0) 0 ( 0.0) 2 ( 50.0) 2 ( 25.0)
Moderate 0 ( 0.0) 1 ( 33.3) 2 (100.0) 3 ( 33.3) 0 ( 0.0) 1 ( 33.3) 1 ( 25.0) 2 ( 25.0)Respiratory, thoracic
and mediastinal
disorders
Cough 2 ( 50.0) 2 ( 66.7) 2 (100.0) 6 ( 66.7) 1 (100.0) 0 ( 0.0) 1 ( 25.0) 2 ( 25.0)
Mild 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 1 (100.0) 0 ( 0.0) 1 ( 25.0) 2 ( 25.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1 ( 25.0) 0 ( 0.0) 1 ( 50.0) 2 ( 22.2) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0)
Severe 0 ( 0.0) 0 ( 0.0) 1 ( 50.0) 1 ( 11.1) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 1 ( 12.5)Nervous system disorders
Headache 1 ( 25.0) 1 ( 33.3) 2 (100.0) 4 ( 44.4) 0 ( 0.0) 1 ( 33.3) 2 ( 50.0) 3 ( 37.5)
Mild 1 ( 25.0) 0 ( 0.0) 0 ( 0.0) 1 ( 11.1) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 1 ( 12.5)
Moderate 0 ( 0.0) 0 ( 0.0) 2 (100.0) 2 ( 22.2) 0 ( 0.0) 0 ( 0.0) 2 ( 50.0) 2 ( 25.0)
Severe 1 ( 25.0) 1 ( 33.3) 0 ( 0.0) 2 ( 22.2) 0 ( 0.0) 1 ( 33.3) 2 ( 50.0) 3 ( 37.5)Tremor 1 ( 25.0) 1 ( 33.3) 1 ( 50.0) 3 ( 33.3) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 1 ( 12.5)
Mild 1 ( 25.0) 1 ( 33.3) 1 ( 50.0) 3 ( 33.3) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 1 ( 12.5)
Moderate 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 1 ( 25.0) 1 ( 12.5)
Severe 1 ( 25.0) 0 ( 0.0) 0 ( 0.0) 1 ( 11.1) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0) 0 ( 0.0)
Disposition
CKD stage 3
CKD stage 4
Total
Placebo Active Placebo Active Placebo Active (N=50) (N=96) (N=53) (N=99) (N=103) (N=195) n(%) n(%) n(%) n(%) n(%) n(%) ________________________________________________________________________________________________________________________ Subjects entering CL-3003 Extension Study 50(100.0) 96(100.0) 53(100.0) 99(100.0) 103(100.0) 195(100.0) Enrolled 50(100.0) 96(100.0) 53(100.0) 99(100.0) 103(100.0) 195(100.0) Follow-up (Visit 5) 47( 94.0) 85( 88.5) 50( 94.3) 93( 93.9) 97( 94.2) 178( 91.3) Randomized (Visit 5) 0( 0.0) 33( 34.4) 0( 0.0) 52( 52.5) 0( 0.0) 85( 43.6) Completed Study (Visit 9) 37( 74.0) 69( 71.9) 33( 62.3) 70( 70.7) 70( 68.0) 139( 71.3) Discontinued (Early Term) 4( 10.0) 5( 9.4) 7( 13.2) 10( 10.1) 7( 6.7) 10( 5.7) Subject Withdrew Consent 1( 2.0) 1( 0.2) 3( 5.7) 1( 1.0) 2( 1.9) 5( 2.6) Serious Adverse Event 1( 4.0) 1( 1.0) 1( 1.9) 2( 2.0) 2( 1.9) 1( 0.5) Subject non-compliance 1( 2.0) 1( 1.0) 0( 0.0) 2( 2.0) 1( 1.0) 1( 0.5) Investigator's Opinion 0( 0.0) 1( 1.0) 0( 0.0) 2( 2.0) 0( 0.0) 1( 0.5) Non-Serious Adverse Event 0( 0.0) 1( 1.0) 0( 0.0) 3( 3.0) 0( 0.0) 4( 2.1) Lost to Follow-up 0( 0.0) 1( 1.0) 2( 3.8) 0( 0.0) 2( 1.9) 1( 0.5) Serum Ca >=11.0 mg/dl 1( 2.0) 0( 0.0) 0( 0.0) 0( 0.0) 1( 1.0) 0( 0.0) Disease Progression per Clin Judgement 0( 0.0) 0( 0.0) 1( 1.9) 0( 0.0) 1( 1.0) 0( 0.0) ITT (Safety) population 50(100.0) 96(100.0) 53(100.0) 99(100.0) 103(100.0) 195(100.0) PP (Efficacy) population 38( 76.0) 75( 78.1) 35( 66.0) 75( 75.8) 73( 70.9) 150( 76.9) Still Ongoing 8( 16.0) 18( 18.8) 13( 24.5) 19( 19.2) 21( 20.4) 37( 19.0) |
First off, the bad news: %npcttab does not allow for no space between "n" and the percentage bracket. This has never been requested before and I have never seen this lack of a space on such a report. So forget that as I will need a good reason to change the macro to allow this style and I don't have a good reason.
The good news is that %npcttab can produce this report directly and there is no need to use its output dataset and manipulate it. Looking at the columns headers first, let us assume that for the six columns we have treatment values 1-6 for a treatment variable. What we can do is assign these six values to a format that goes "Placebo", "Active", "Placebo", "Active", "Placebo", "Active" and have that format already assigned to the treatment variable. The upper labels "CKD stage 3", "CKD stage 4", "Total" can be assigned using the trtvarlist= parameter as explained in the macro header for that parameter. You will also see the "n(%)" as the bottom line in the column header. We can use suffix="@n (%)" in the call to %popfmt to give us that final column line, assuming we are using "@" as a split character and I have added the space before the bracket as %npcttab will give us that space whether we want it or not. Next, we note there is no line throw after the column header solid line. We can achieve that with headskip=no. This is a report using mid level terms and low level terms. There is no line throw between the mid level terms. We can achieve that using the parameter midskip=no. Next we notice that for "Discontinued (Early Term)" we have counts and percentages shown on this mid level line. This you can achieve as shown in Demo 11 above. Next we notice that "Discontinued (Early Term)" has low level terms but the others do not. This is because the low level terms for all the other categories have been given the value "XXX" and the parameter droplowlvl="XXX" has been used to delete these lines from the output dataset. And that is all that was required to achieve this complex but common style report using %npcttab.
Use the "Back" button of your browser to return to the previous page.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.