|
On Thu, 9 Nov 2006 16:11:08 -0500, Roland Rivers <seatedcoin@GMAIL.COM> wrote:
>I want to be able to unblind a drug trial automatically without having to
>change the column headers by hardcoding. For example I might have the
>following blinded INPUT data:
>
>Patient # Disposition Treatment
>1 Completed Blinded
>2 Discontinued Blinded
>3 Completed Blinded
>
>Output
> Treatment Counts
>Disposition Blinded
>----------- -------
>Completed 2
>Discontinued 1
>
>Once the study becomes unblinded (Treatments A and B rather than Blinded)
>I want to automatically be able to produce output without hardcoding the
>output columns.
>
>Unblinded Input:
>
>Patient # Disposition Treatment
>1 Completed A
>2 Discontinued B
>3 Completed A
>
>Dersired Output after the trial has been unblinded
> Treatment Counts
> ----------------
>Disposition A B
>------------ --- --
>Completed 2 0
>Discontinued 0 1
PROC TABULATE does this naturally. Consider:
data demo;
input Before_or_After $ Patient Disposition :$12. Treatment $;
cards;
Before 1 Completed Blinded
Before 2 Discontinued Blinded
Before 3 Completed Blinded
After 1 Completed A
After 2 Discontinued B
After 3 Completed A
;
options formchar = "|----|+|---+=|-/\<>*";
proc tabulate data=demo;
by descending Before_or_After;
class disposition treatment;
table n*f=10., disposition, treatment;
run;
Results:
Before_or_After=Before
N
---------------------------
| |Treatment |
| |----------|
| | Blinded |
|--------------+----------|
|Disposition | |
|--------------| |
|Completed | 2|
|--------------+----------|
|Discontinued | 1|
---------------------------
Before_or_After=After
N
--------------------------------------
| | Treatment |
| |---------------------|
| | A | B |
|--------------+----------+----------|
|Disposition | | |
|--------------| | |
|Completed | 2| .|
|--------------+----------+----------|
|Discontinued | .| 1|
--------------------------------------
|