Hi, I am wondering if there is a way to do a search on just a part of a
variable. I have a long list of drugs and their dosages, for example, "00002323230-Symbyax 12-25 mg capsule". The numbers and dosage may vary from case to case. I would like to find all cases that include Symbyax. How would I specify this? Thanks in advance for your help. Vicki L. Stirkey OMHSAS Office of Mental Health and Substance Abuse Services 717-705-8198 Fax: 717-772-6737 |
This works.
IF ( INDEX((DrugName),'Symbyax')>0 ) FlagSymbyax = 1. Filter by FlagSymbyax. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of Stirkey, Vicki Sent: Wednesday, November 15, 2006 10:55 AM To: [hidden email] Subject: Using Select cases capability in SPSS Hi, I am wondering if there is a way to do a search on just a part of a variable. I have a long list of drugs and their dosages, for example, "00002323230-Symbyax 12-25 mg capsule". The numbers and dosage may vary from case to case. I would like to find all cases that include Symbyax. How would I specify this? Thanks in advance for your help. Vicki L. Stirkey OMHSAS Office of Mental Health and Substance Abuse Services 717-705-8198 Fax: 717-772-6737 |
In reply to this post by Stirkey, Vicki
Vicki,
suppose, your data stored in variable 'a'. The following syntax instruction will put ones to variable 'sel' for those cases where "Symbyax" is in variable 'a'. compute sel=INDEX(a,"Symbyax")>0. Next two instructions will select cases with "Symbyax" in 'a'. select if sel. execute. Hope this helps, Anton > -----Original Message----- > From: SPSSX(r) Discussion [mailto:[hidden email]] > On Behalf Of Stirkey, Vicki > Sent: Wednesday, November 15, 2006 6:55 PM > To: [hidden email] > Subject: Using Select cases capability in SPSS > > > Hi, I am wondering if there is a way to do a search on just a > part of a variable. I have a long list of drugs and their > dosages, for example, "00002323230-Symbyax 12-25 mg capsule". > The numbers and dosage may vary from case to case. I would > like to find all cases that include Symbyax. How would I > specify this? Thanks in advance for your help. > > > > Vicki L. Stirkey > > OMHSAS > > Office of Mental Health and Substance Abuse Services > > 717-705-8198 > > Fax: 717-772-6737 > > > |
In reply to this post by Stirkey, Vicki
Hi Vicki
If the index is the same for all the drugs you can simply use SUBSTR. SUBSTR(strexpr,pos,length). String. Returns the substring beginning at position pos of strexpr and running for length length. So for you in your select statement may want FILTER OFF. USE ALL. SELECT IF ((SUBSTR(VARIABLE NAME HERE,13,7) = 'Symbyax')). EXECUTE . This will of course delete all those not selected. HtH Mike -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Stirkey, Vicki Sent: 15 November 2006 15:55 To: [hidden email] Subject: Using Select cases capability in SPSS Hi, I am wondering if there is a way to do a search on just a part of a variable. I have a long list of drugs and their dosages, for example, "00002323230-Symbyax 12-25 mg capsule". The numbers and dosage may vary from case to case. I would like to find all cases that include Symbyax. How would I specify this? Thanks in advance for your help. Vicki L. Stirkey OMHSAS Office of Mental Health and Substance Abuse Services 717-705-8198 Fax: 717-772-6737 ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
In reply to this post by Stirkey, Vicki
Use this syntax (copy and paste into a syntax window):
COMPUTE symbyax = INDEX(drug,'Symbyax') GT 0. EXECUTE. This will create a variable called symbyax with a value of 1 when the string 'Symbyax' is found anywhere in the string variable called drug. The EXECUTE statement can be omitted if you are running other procedures after the COMPUTE statement. Cheers --jim -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Stirkey, Vicki Sent: Wednesday, November 15, 2006 9:55 AM To: [hidden email] Subject: Using Select cases capability in SPSS Hi, I am wondering if there is a way to do a search on just a part of a variable. I have a long list of drugs and their dosages, for example, "00002323230-Symbyax 12-25 mg capsule". The numbers and dosage may vary from case to case. I would like to find all cases that include Symbyax. How would I specify this? Thanks in advance for your help. Vicki L. Stirkey OMHSAS Office of Mental Health and Substance Abuse Services 717-705-8198 Fax: 717-772-6737 |
In reply to this post by Edward Boadi
That works fine, but to be safe, you might want to ignore case in the search:
IF (INDEX(upcase(DrugName)),upcase('Symbyax') > 0 ) FlagSymbyax = 1. -Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Edward Boadi Sent: Wednesday, November 15, 2006 10:09 AM To: [hidden email] Subject: Re: [SPSSX-L] Using Select cases capability in SPSS This works. IF ( INDEX((DrugName),'Symbyax')>0 ) FlagSymbyax = 1. Filter by FlagSymbyax. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of Stirkey, Vicki Sent: Wednesday, November 15, 2006 10:55 AM To: [hidden email] Subject: Using Select cases capability in SPSS Hi, I am wondering if there is a way to do a search on just a part of a variable. I have a long list of drugs and their dosages, for example, "00002323230-Symbyax 12-25 mg capsule". The numbers and dosage may vary from case to case. I would like to find all cases that include Symbyax. How would I specify this? Thanks in advance for your help. Vicki L. Stirkey OMHSAS Office of Mental Health and Substance Abuse Services 717-705-8198 Fax: 717-772-6737 |
In reply to this post by Stirkey, Vicki
Some of my students were trying to access their data that they had entered and when they came back to open it, the Text Import Wizard kept coming up and they could not find their data. The file had been saved as .sav I did not know if anyone could help with this. Thanks, Candace
|
What are they doing to try to open it?
starting SPSS clicking the radio button for <select an existing data source> and then click the file name? double clicking the file name in Windows Explorer? or its equivalent on your platform> Starting SPSS, dismissing the dialog box, then clicking <file> <open> <data> and browsing to their file? Art Kendall Social Research Consultants Candace R. Hansford wrote: >Some of my students were trying to access their data that they had entered and when they came back to open it, the Text Import Wizard kept coming up and they could not find their data. The file had been saved as .sav I did not know if anyone could help with this. Thanks, Candace > > > >
Art Kendall
Social Research Consultants |
In reply to this post by Candace R. Hansford
The Text Import Wizard is used to open non-SPSS file (e.g. .txt files)
as an SPSS (.sav) file. If you already have a .sav file, you should be able to just open that datafile. However, if you saved a .txt file as FILENAME.sav and it was not an SPSS file, you should be able to change the option in the 'Files as Type' box--one option is SPSS files (*.sav) and one is All file (*.*) and still be able to use the text wizard. Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Candace R. Hansford Sent: Wednesday, November 15, 2006 11:44 AM To: [hidden email] Subject: [SPSSX-L] Text Import Wizard Some of my students were trying to access their data that they had entered and when they came back to open it, the Text Import Wizard kept coming up and they could not find their data. The file had been saved as .sav I did not know if anyone could help with this. Thanks, Candace PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. |
Free forum by Nabble | Edit this page |