It would be fairly straightforward to do this using the JMP formula editor.
(JMP is a pull-down product available from SAS, but it is much cheaper than
SAS.)
The syntax would look something like:
(If( :drug 1 == "A", "A", :drug 2 == "A", "A", :drug 3 == "A", "A", :drug
4 == "A", "A", :drug 5 == "A", "A", :drug 6 == "A", "A", Empty()) || If(
:drug 1 == "B", "B", :drug 2 == "B", "B", :drug 3 == "B", "B", :drug 4 ==
"B", "B", :drug 5 == "B", "B", :drug 6 == "B", "B", Empty())) || ....
The "...." just means continue the same way with the other drugs. The ||
sign means "concatenate". You could use the same sort of logic in a set of
IF statements in SAS.
-------------------------------------------
Emil M Friedman, PhD
2304 Richmond Road
Beachwood, OH 44122
[log in to unmask]
216-591-1750
----- Original Message -----
From: "Stephen W Kay" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Wednesday, April 02, 2003 4:44 AM
Subject: Re: Data manipulation question
> Hi,
>
> I recently had a data manipulation problem I couldn't handle in any of my
> stats packages. In the end I had to program VBA routines in Excel to solve
> my problem. Whilst I enjoyed the challenge, I do wonder if I've
> underestimated the ability of stats packages in manipulating data.
> Accordingly could anyone please tell me if it is reasonably straight
forward
> to solve the following data manipulation problem in routine packages (and
if
> yes which package and what commands to use):
>
> I'm analysing patients on drugs. Patients can be on more than one
> drug. I have six variables, drugs1 through to drugs6 (i.e. a patient can
be
> on at most 6 different drugs). Each of these six drug variables can hold
any
> drug. I want to run a frequency count on the drug combinations patients
are
> on. I cannot simply concatenate the six variables because the frequency
> analysis will not recognise that order is not important (i.e. it doesn't
> recognise "Drug A & Drug B" = "Drug B & Drug A"). I could concatenate and
> then run a sort routine on each concatenated value (thus putting them in
the
> same order -
> but I don't think any stats package lets you do this?). Maybe there are
> other ways to accomplish my aim?
>
> Probably like a lot of people I spend as much time getting my data in the
> correct form as I do actually analysing it. Any help much appreciated.
>
> Cheers,
>
> Steve
>
> Stephen Kay
> Head of Statistics
>
> Adelphi Group Products
> www.adelphigroup.com
>
> Adelphi retains ownership of all data and fieldwork materials. In
accordance
> with the company's Terms and Conditions, written prior approval must be
> obtained with regard to any use of the data in any items submitted for
> publication or for use in marketing materials.
>
|