|
Dear listers,
I have a data file that I want to filter on certain diagnosis, for example Diag1 = 2700 or Diag1 = 2770 or Diag1 = 3900 Problem is there are 50 diagnosis and underlying diagnosis: Diag1 till Diag50 each with several hundreds of possibilities. Therefore if I want to create a filter for all cases that have diagnosis 2770 I can do this: Diag1=2770 OR Diag2=2770 OR Diag3=2770 OR etc.......till Diag50=2770 and so on for every diagnosis. Simpler would be to select for exampe: Diag1=2770 to Diag50=2770 I already tried: COMPUTE filter_$=(Diag1 =2770 TO Diag50=2770)etc. that didn't work COMPUTE filter_$=(Diag1 =2770 - Diag50=2770)etc. didn't work either. Is there a shorter syntax for this filter? I can't find this in the spss tutorials. Thanks, Leo Bakker ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Hello,
Function "any" will help. SELECT if any (2770,diag1 to diag50). best JIndra > ------------ Původní zpráva ------------ > Od: Leo Bakker <[hidden email]> > Předmět: selecting cases > Datum: 23.9.2008 12:34:46 > ---------------------------------------- > Dear listers, > > I have a data file that I want to filter on certain diagnosis, for example > Diag1 = 2700 or Diag1 = 2770 or Diag1 = 3900 > Problem is there are 50 diagnosis and underlying diagnosis: Diag1 till > Diag50 each with several hundreds of possibilities. > Therefore if I want to create a filter for all cases that have diagnosis > 2770 I can do this: Diag1=2770 OR Diag2=2770 OR Diag3=2770 OR > etc.......till Diag50=2770 and so on for every diagnosis. > Simpler would be to select for exampe: Diag1=2770 to Diag50=2770 > > I already tried: > COMPUTE filter_$=(Diag1 =2770 TO Diag50=2770)etc. > that didn't work > COMPUTE filter_$=(Diag1 =2770 - Diag50=2770)etc. > didn't work either. > Is there a shorter syntax for this filter? > I can't find this in the spss tutorials. > > > Thanks, > Leo Bakker > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD > > > ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
In reply to this post by Leo Bakker
Look at the ANY function. It takes two arguments a single value and a list.
The single value would be the value and the list would be the list of variables. Note that it allows you to specify a list with TO convention. Also, why do you want to cycle through 50 filters? Why not use the split file command with a variable containing the 50 values. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Leo Bakker Sent: Tuesday, September 23, 2008 4:30 AM To: [hidden email] Subject: selecting cases Dear listers, I have a data file that I want to filter on certain diagnosis, for example Diag1 = 2700 or Diag1 = 2770 or Diag1 = 3900 Problem is there are 50 diagnosis and underlying diagnosis: Diag1 till Diag50 each with several hundreds of possibilities. Therefore if I want to create a filter for all cases that have diagnosis 2770 I can do this: Diag1=2770 OR Diag2=2770 OR Diag3=2770 OR etc.......till Diag50=2770 and so on for every diagnosis. Simpler would be to select for exampe: Diag1=2770 to Diag50=2770 I already tried: COMPUTE filter_$=(Diag1 =2770 TO Diag50=2770)etc. that didn't work COMPUTE filter_$=(Diag1 =2770 - Diag50=2770)etc. didn't work either. Is there a shorter syntax for this filter? I can't find this in the spss tutorials. Thanks, Leo Bakker ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Jindra, ViAnne,
Excuse me for being not so good in SPSS, but If I use the suggested SELECT if any (2770,diag1 to diag50). I lose the rest of the file before I can select other cases identified by another variable. I do not know if the split file will work in this case. What is I want to select all patients with cancer in a database while this is not directly a discharge reason or admission indication. There are some variables like specialism and underlying diagnosis which I hopefully can use to identify this group I hope this will give you some more information. So I want to try to combine this IF ANY statement with different other variables, if possible. Leo -----Oorspronkelijk bericht----- Van: ViAnn Beadle [mailto:[hidden email]] Verzonden: dinsdag 23 september 2008 15:04 Aan: 'Leo Bakker'; [hidden email] Onderwerp: RE: selecting cases Look at the ANY function. It takes two arguments a single value and a list. The single value would be the value and the list would be the list of variables. Note that it allows you to specify a list with TO convention. Also, why do you want to cycle through 50 filters? Why not use the split file command with a variable containing the 50 values. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Leo Bakker Sent: Tuesday, September 23, 2008 4:30 AM To: [hidden email] Subject: selecting cases Dear listers, I have a data file that I want to filter on certain diagnosis, for example Diag1 = 2700 or Diag1 = 2770 or Diag1 = 3900 Problem is there are 50 diagnosis and underlying diagnosis: Diag1 till Diag50 each with several hundreds of possibilities. Therefore if I want to create a filter for all cases that have diagnosis 2770 I can do this: Diag1=2770 OR Diag2=2770 OR Diag3=2770 OR etc.......till Diag50=2770 and so on for every diagnosis. Simpler would be to select for exampe: Diag1=2770 to Diag50=2770 I already tried: COMPUTE filter_$=(Diag1 =2770 TO Diag50=2770)etc. that didn't work COMPUTE filter_$=(Diag1 =2770 - Diag50=2770)etc. didn't work either. Is there a shorter syntax for this filter? I can't find this in the spss tutorials. Thanks, Leo Bakker ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Leo,
It sounds like your selection problem is quite complex and that the any(2770,diag1 to diag50)' is just one part. To get the correct selection, you will need to combine several parts. For instance, Compute diag2770=any(2770,diag1 to diag50). Compute diag2700=any(2700,diag1 to diag50). Compute diag3900=any(3900,diag1 to diag50). Compute anydiag=any(1,diag2700,diag2770,diag3900). With this syntax you can also do crosstabs to see the overlap in your diagnosis criteria variables. Gene Maguin ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
