Help with syntax

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with syntax

Hans-Christian Stahl
Dear List-Members,



Physicians were asked for each patient to answer with yes or no to 16
different single substances, which by way of combination, indicate the
chemotherapy-scheme of each patient. The substances are therefore multiple
response answers. How can I now find out the combinations for each patient
and how can I do a frequency analysis of the combinations?



Can someone help me with the programming of the syntax?



That's how I thought it might be logically possible to find a solution to
the problem:



*Begin.



The combination of the substances is given for each patient. If a substance
occurs, the answer is yes or coded 0.



Let

X = Cisplatin

Y = Erbitux

Z = Avastin



And let for instance be: X=0 und Y=0 und Z=1.



if (in the list of the substances (X, Y, Z . ), the substance variables (X,
Z, Y ...) = 0) make string variable with (substance variable label (here:
Cisplatin Erbitux)).



*End.



Your help is very much appreciated! Thank you in advance!

Christian
Reply | Threaded
Open this post in threaded view
|

Re: Help with syntax

Spousta Jan
Hi Hans-Christian,

In this case, the best way probably is to create a new variable with combinations of strings or numbers from the original variables, for example this way (on an example file from the SPSS instalation):

GET
  FILE='C:\Program Files\SPSS\1991 U.S. General Social Survey.sav'.

* let us find combinations in these variables:
hlth1 Ill Enough to Go to a Doctor
hlth2 Counselling for Mental Problems
hlth3 Infertility, Unable to Have a Baby
hlth4 Drinking Problem
hlth5 Illegal Drugs (Marijuana, Cocaine) .
string combin (a120).
do repe x = hlth1 to hlth5 / y = "Ill" "Mental" "Infertil" "Drink" "Drugs".
if x = 1 combin = concat(rtrim(combin)," ",y).
end repe.
var lab combin "Codes of combinations".

fre combin /FORMAT=DFREQ.


Perhaps you can recode it into a numeric variable thereafter:

AUTORECODE
  VARIABLES=combin  /INTO combinr
  /PRINT.

Greetings

Jan


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Hans-Christian Stahl
Sent: Tuesday, October 09, 2007 2:50 PM
To: [hidden email]
Subject: Help with syntax

Dear List-Members,



Physicians were asked for each patient to answer with yes or no to 16 different single substances, which by way of combination, indicate the chemotherapy-scheme of each patient. The substances are therefore multiple response answers. How can I now find out the combinations for each patient and how can I do a frequency analysis of the combinations?



Can someone help me with the programming of the syntax?



That's how I thought it might be logically possible to find a solution to the problem:



*Begin.



The combination of the substances is given for each patient. If a substance occurs, the answer is yes or coded 0.



Let

X = Cisplatin

Y = Erbitux

Z = Avastin



And let for instance be: X=0 und Y=0 und Z=1.



if (in the list of the substances (X, Y, Z . ), the substance variables (X, Z, Y ...) = 0) make string variable with (substance variable label (here:
Cisplatin Erbitux)).



*End.



Your help is very much appreciated! Thank you in advance!

Christian



_____

Tato zpráva a všechny připojené soubory jsou důvěrné a určené výlučně adresátovi(-ům). Jestliže nejste oprávněným adresátem, je zakázáno jakékoliv zveřejňování, zprostředkování nebo jiné použití těchto informací. Jestliže jste tento mail dostali neoprávněně, prosím, uvědomte odesilatele a smažte zprávu i přiložené soubory. Odesilatel nezodpovídá za jakékoliv chyby nebo opomenutí způsobené tímto přenosem.

This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the message as well as all attached documents. The sender does not accept liability for any errors or omissions as a result of the transmission.

-.- --
Reply | Threaded
Open this post in threaded view
|

Re: Help with syntax

arandren
In reply to this post by Hans-Christian Stahl
Hans-Christian !

COMPUTE NEWAR (or whatever you like to call it) = one of the numbers below in turn.

Then, in turn, you do a “select if” with statements  like the ones below

(X = 0 & y = 0 & z = 1)  = 1
(X = 0 & Y = 1 & Z = 1) = 2
(X = 1 & Y = 1 & Z = 1) = 3
(X = 0 & Y = 1 & Z = 0) = 4
(X = 0 & Y = 0 & Z =0)  = 5
(X = 1 & Y = 0 & Z = 0) = 6
Etc

With 16 +/- variables you have some tedious work to do.

Good luck.

HTH / Anders

Hans-Christian Stahl wrote
Dear List-Members,



Physicians were asked for each patient to answer with yes or no to 16
different single substances, which by way of combination, indicate the
chemotherapy-scheme of each patient. The substances are therefore multiple
response answers. How can I now find out the combinations for each patient
and how can I do a frequency analysis of the combinations?



Can someone help me with the programming of the syntax?



That's how I thought it might be logically possible to find a solution to
the problem:



*Begin.



The combination of the substances is given for each patient. If a substance
occurs, the answer is yes or coded 0.



Let

X = Cisplatin

Y = Erbitux

Z = Avastin



And let for instance be: X=0 und Y=0 und Z=1.



if (in the list of the substances (X, Y, Z . ), the substance variables (X,
Z, Y ...) = 0) make string variable with (substance variable label (here:
Cisplatin Erbitux)).



*End.



Your help is very much appreciated! Thank you in advance!

Christian
Reply | Threaded
Open this post in threaded view
|

Frequency of combo of variables - was Re: Help with syntax

Catherine Kubitschek
Christian,

You might try something like this:

* fake data for testing (for example, a could equal Cisplatin) .
data list
  /a b c d e f g h i j k l m n o p 1-16 .
begin data
1011100101001100
0001001011010010
1011100101001100
0100011100110101
1101110011101100
0011101100011010
0100011100110101
1101110011101100
end data .
* merge all the data into a single variable .
compute FRQ=a*10**15
            +b*10**14
            +c*10**13
            +d*10**12
            +e*10**11
            +f*10**10
            +g*10** 9
            +h*10** 8
            +i*10** 7
            +j*10** 6
            +k*10** 5
            +l*10** 4
            +m*10** 3
            +n*10** 2
            +o*10
            +p .
* set the format to left fill with 0 .
formats FRQ (N16.0) .
* here's the frequency .
frequencies var=FRQ .

If you are using strings instead of numbers (Y,0 instead of 1,0) you can
concatenate the variables but the frequencies command will be based on only
the first 8 characters.  You might create two 8 character strings by
concatenation and then do a crosstabs.

Catherine

Hans-Christian Stahl wrote:

>Dear List-Members,
>
>Physicians were asked for each patient to answer with yes or no to 16
>different single substances, which by way of combination, indicate the
>chemotherapy-scheme of each patient. The substances are therefore multiple
>response answers. How can I now find out the combinations for each patient
>and how can I do a frequency analysis of the combinations?
>
>Can someone help me with the programming of the syntax?
>
>That's how I thought it might be logically possible to find a solution to
>the problem:
>
>  *Begin.
>
>The combination of the substances is given for each patient. If a
>substance occurs, the answer is yes or coded 0.
>
>Let
>  X = Cisplatin
>  Y = Erbitux
>  Z = Avastin
>
>And let for instance be: X=0 und Y=0 und Z=1.
>
>if (in the list of the substances (X, Y, Z . ), the substance variables
>(X, Z, Y ...) = 0) make string variable with (substance variable label
>(here: Cisplatin Erbitux)).
>
>*End.
>
>Your help is very much appreciated! Thank you in advance!
>
>Christian


Catherine Kubitschek         ([hidden email])
Sr. Programmer/Analyst        574/631-3550
Institutional Research
210 Flanner Hall
University of Notre Dame
Notre Dame, IN  46556-5611
Reply | Threaded
Open this post in threaded view
|

Re: Frequency of combo of variables

Richard Ristow
In reply to this post by Hans-Christian Stahl
At 08:49 AM 10/9/2007, Hans-Christian Stahl wrote:

>Physicians were asked for each patient to answer with yes or no to 16
>different single substances, which by way of combination, indicate the
>chemotherapy-scheme of each patient. The substances are therefore
>multiple response answers. How can I now find out the combinations for
>each patient and how can I do a frequency analysis of the combinations?

I can't improve on Jan Spousta's, although the AUTORECODE is
imperative, not optional - as Catherine Kubitschek reminded, "the
frequencies [categories] will be based on only the first 8 characters"
of a string variable.

Be careful with AUTORECODE, though. Add any data with a combination
that wasn't there before, and codes change for many of the old
combinations.

Interesting question: How many drug combinations will occur? There are
2**16 possible, far too many to tabulate, but I suppose many don't
occur. But there are almost 700 possible combinations of three or fewer
drugs.









>Can someone help me with the programming of the syntax?
>
>
>
>That's how I thought it might be logically possible to find a solution
>to
>the problem:
>
>
>
>*Begin.
>
>
>
>The combination of the substances is given for each patient. If a
>substance
>occurs, the answer is yes or coded 0.
>
>
>
>Let
>
>X = Cisplatin
>
>Y = Erbitux
>
>Z = Avastin
>
>
>
>And let for instance be: X=0 und Y=0 und Z=1.
>
>
>
>if (in the list of the substances (X, Y, Z . ), the substance
>variables (X,
>Z, Y ...) = 0) make string variable with (substance variable label
>(here:
>Cisplatin Erbitux)).
>
>
>
>*End.
>
>
>
>Your help is very much appreciated! Thank you in advance!
>
>Christian
>
>
>
>--
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.5.488 / Virus Database: 269.14.4/1057 - Release Date:
>10/8/2007 9:04 AM
Reply | Threaded
Open this post in threaded view
|

Re: Frequency of combo of variables

Spousta Jan
Hi Richard, Catherine, and Christian,

It is not generally true that the frequencies are made only of the first 8 characters of a string. I am not sure but perhaps it depends on the version of SPSS. I am running SPSS 14 now and I have no problems with long strings. This syntax:

data list list / mystring (a60).
begin data.
I_am_a_very_very_very_very_very_very_very_long_string_#1
I_am_a_very_very_very_very_very_very_very_long_string_#2
I_am_a_very_very_very_very_very_very_very_long_string_#3
end data.
fre mystring .

Produces on my computer:

                Frequency       Percent Valid Percent   Cumulative Percent
Valid   I_am_a_very_very_very_very_very_very_very_long_string_#1        1       33,3    33,3    33,3
        I_am_a_very_very_very_very_very_very_very_long_string_#2        1       33,3    33,3    66,7
        I_am_a_very_very_very_very_very_very_very_long_string_#3        1       33,3    33,3    100,0
        Total   3       100,0   100,0

But perhaps with the older versions (until 9? until 6?) there is the problem Catherine mentioned - someone who runs such versions can try and tell us.

Best regards,

Jan


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Richard Ristow
Sent: Thursday, October 11, 2007 4:42 AM
To: [hidden email]
Subject: Re: Frequency of combo of variables

At 08:49 AM 10/9/2007, Hans-Christian Stahl wrote:

>Physicians were asked for each patient to answer with yes or no to 16
>different single substances, which by way of combination, indicate the
>chemotherapy-scheme of each patient. The substances are therefore
>multiple response answers. How can I now find out the combinations for
>each patient and how can I do a frequency analysis of the combinations?

I can't improve on Jan Spousta's, although the AUTORECODE is imperative, not optional - as Catherine Kubitschek reminded, "the frequencies [categories] will be based on only the first 8 characters"
of a string variable.

Be careful with AUTORECODE, though. Add any data with a combination that wasn't there before, and codes change for many of the old combinations.

Interesting question: How many drug combinations will occur? There are
2**16 possible, far too many to tabulate, but I suppose many don't occur. But there are almost 700 possible combinations of three or fewer drugs.









>Can someone help me with the programming of the syntax?
>
>
>
>That's how I thought it might be logically possible to find a solution
>to the problem:
>
>
>
>*Begin.
>
>
>
>The combination of the substances is given for each patient. If a
>substance occurs, the answer is yes or coded 0.
>
>
>
>Let
>
>X = Cisplatin
>
>Y = Erbitux
>
>Z = Avastin
>
>
>
>And let for instance be: X=0 und Y=0 und Z=1.
>
>
>
>if (in the list of the substances (X, Y, Z . ), the substance variables
>(X, Z, Y ...) = 0) make string variable with (substance variable label
>(here:
>Cisplatin Erbitux)).
>
>
>
>*End.
>
>
>
>Your help is very much appreciated! Thank you in advance!
>
>Christian
>
>
>
>--
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.5.488 / Virus Database: 269.14.4/1057 - Release Date:
>10/8/2007 9:04 AM



_____

Tato zpráva a všechny připojené soubory jsou důvěrné a určené výlučně adresátovi(-ům). Jestliže nejste oprávněným adresátem, je zakázáno jakékoliv zveřejňování, zprostředkování nebo jiné použití těchto informací. Jestliže jste tento mail dostali neoprávněně, prosím, uvědomte odesilatele a smažte zprávu i přiložené soubory. Odesilatel nezodpovídá za jakékoliv chyby nebo opomenutí způsobené tímto přenosem.

This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the message as well as all attached documents. The sender does not accept liability for any errors or omissions as a result of the transmission.

-.- --
Reply | Threaded
Open this post in threaded view
|

Re: Frequency of combo of variables

Catherine Kubitschek
Well, I'll be!  It works just like you said Jan.  I'm running SPSS 14 and I
just trusted the Command Syntax Reference manual (p.652):

         Only the short-string portion of long-string variables are tabulated.

This will make some people in my office very happy.

Catherine

At 10/11/2007 03:21 AM, Spousta Jan wrote:

>Hi Richard, Catherine, and Christian,
>
>It is not generally true that the frequencies are made only of the first 8
>characters of a string. I am not sure but perhaps it depends on the
>version of SPSS. I am running SPSS 14 now and I have no problems with long
>strings. This syntax:
>
>data list list / mystring (a60).
>begin data.
>I_am_a_very_very_very_very_very_very_very_long_string_#1
>I_am_a_very_very_very_very_very_very_very_long_string_#2
>I_am_a_very_very_very_very_very_very_very_long_string_#3
>end data.
>fre mystring .
>
>Produces on my computer:
>
>                 Frequency       Percent Valid Percent   Cumulative Percent
>Valid   I_am_a_very_very_very_very_very_very_very_long_string_#1        1
>      33,3    33,3    33,3
>         I_am_a_very_very_very_very_very_very_very_long_string_#2        1
>        33,3    33,3    66,7
>         I_am_a_very_very_very_very_very_very_very_long_string_#3        1
>        33,3    33,3    100,0
>         Total   3       100,0   100,0
>
>But perhaps with the older versions (until 9? until 6?) there is the
>problem Catherine mentioned - someone who runs such versions can try and
>tell us.
>
>Best regards,
>
>Jan