What you will see below is a report used on actual study data that was sent to me. The data is blinded and I have permission to web it. The dataset is called vital_vert and I have stored it in the Spectre folder. It calls two formats that I do not have and two of the variables named _name_ and _label_ have to be changed since this would clash with the transposes done inside the %unistats macro. If you browse this data then make sure you use the "nofmterr" option because of the missing formats. Although this is inconvenient, I want you to realise that this is real study data that I am using so I am not making the data up to suit my macros. %unistats and %npcttab should be able to do all your safety reporting. It is just a case of getting to know what the macros do and the way they work. %npcttab can give you good reports and %unistats can give you a good category report, using a call to %unicatrep, but to get other reports from %unistats you have to use your skills with "proc report". But %unistats can do a lot of work for you. Importantly, you should never have to transpose your data in your code because %unistats can do that for you. That way, your programs should take the form of calls to %npcttab or %unistats and the rest of the work will be no more than merges and "proc report" steps. Data manipulation should be done inside %npcttab or %unistats and not in your code. This simplifies the validation process.
Note in the code below that I am using this data as the population data input to %popfmt to give the population totals. Normally, I would use a population dataset for this, but I do not have one to go with this data.
I want you to look at the call to %unistats in the code below. It is
very simple. Note the "byvars". %unistats will keep these variables in
the output dataset so that I can use them to produce the report I want
to when I call "proc report". I will want to show the parameter label
and the visit number on my report and I want to use the short parameter
name
to order the output (although I won't display it).
/* Demonstration 1 of %unistats used to create a lab/vital signs
table */
options nofmterr nocenter ls=132; libname spectre "C:\spectre";
proc format;
*- fix some variable names and change some formats -;
%popfmt(vital,treat,uniqueid=pat)
%unistats(dsin=vital,print=no,
proc report missing headline nowd split="@" data=transtat spacing=2;
|
Before we look at the output, I thought I would mention something about
the last "proc report" step in the code above. If you look at the "proc
report" code above, you will see that I have asked for the "sum" of n,
min, mean, max and std. You might not feel comfortable using "sum" in your
code as it has the potential of adding two or more numbers together (I
know it won't in this case). But there is a trick you can use with proc
report to allow you to use "display" instead of "sum". What you do is use
a non-existent "noprint" variable that "proc report" will treat as "computed"
and then it will work the same. Here is the altered "proc report" code.
The variable "_foolrep" is not present in the input dataset.
proc report missing headline nowd split="@" data=transtat spacing=2;
columns name label visit treat,(n min mean max std) _foolrep; define name / group order=internal noprint; define label / group "Parameter" width=32; define visit / group order=internal "Visit" width=5 f=2. center; define treat / across ; define n / display spacing=5; define min / display; define mean / display; define max / display; define std / display spacing=1; define _foolrep / noprint; break after name / skip; run; |
Treatment Arm
Drug A Drug B (N=19) (N=21) Parameter Visit N Min Mean Max STD. N Min Mean Max STD. _______________________________________________________________________________________________________ Diastolic blood pressure [mmHg] 1 19 60 72.9 90 7.13 21 60 76.0 100 12.71 2 19 60 71.6 90 7.46 21 60 73.3 100 9.40 3 17 60 73.5 90 9.15 19 70 78.2 90 7.30 4 13 60 70.8 80 7.32 20 60 73.6 90 8.22 5 14 60 72.1 90 8.71 19 60 72.6 85 8.23 6 12 60 70.8 85 7.02 18 60 77.2 100 12.63 7 13 60 71.5 90 9.66 18 60 76.1 90 9.48 Puls [/min]
1 19 45
68.8 88 10.05 21
56 69.4 88 7.79
Systolic blood pressure [mmHg]
1 19 100 118.2
140 12.38 21 90 118.1
150 17.99
|
/* Demonstration 2 of %unistats used to create a lab/vital signs
table */
options nofmterr nocenter ls=132; libname spectre "C:\spectre";
proc format;
*- fix some variable names and change some formats -;
%popfmt(vital,treat,uniqueid=pat)
%unistats(dsin=vital,print=no,
%macro rep;
|
_____Treatment Arm______
Drug A Drug B
2 N
19 21
3 N
17 19
4 N
13 20
5 N
14 19
6 N
12 18
7 N
13 18
Puls [/min]
1 N
19 21
2 N
19 21
Drug A Drug B
3 N
17 19
4 N
13 20
5 N
14 19
6 N
12 18
7 N
13 18
Systolic blood pressure [mmHg]
1 N
19 21
2 N
19 21
3 N
17 19
Drug A Drug B
4 N
13 20
5 N
14 19
6 N
12 18
7 N
13 18
|
I am hoping for more datasets to be sent to me so that I can demonstrate
how more complex lab/vital signs tables can be produced. That is the reason
the title of this page has a "(1)" in it, signifying this is the first
of such a demonstration.
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.