multiple responses coded into something else

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

multiple responses coded into something else

Govind Acharya
Hi all,

I have a dataset (which is partially reproduced as csv text below) that
has multiple responses separated by two spaces (saved as a string).  For
example, variable X might have "  8  9" in one obs but "2  3  4"  in
another.  This is done on purpose, because I am checking to test the
accuracy of scanning software.  What I would like to recode this as
'88', which is not a missing variable, but rather coded so that we can
no that it is a multiple answer observation.  Is there a way that is
general enough that SPSS would say that if there is this combination,
then it will replace with '88'.  Thanks in advance your assistance.

Govind

CASEID,SURVBAR,RESYR,RESYRCA,RSDT00,RSDT01,RSDT02,RSDT03,RSDT04,RSDT05,RENT6M,RENT3,RENT5,RENT12,RENT30,RENTNOW,RURL6M,RURL3,RURL5,RURL12,RURL30,RURLNOW,BEDR6M,BEDR3,BEDR5,BEDR12,BEDR30,BEDRNOW,DAYC6M,DAYC3,DAYC5,PET6M,PET3,PET5,PET12,PET30,PETNOW,HOOF6M,HOOF3,HOOF5,HOOF12,HOOF30,HOOFNOW,MEDBABW,MEDASPW,MEDIBUW,MEDOTHW,MEDCOXW,MEDACEW
897,897,3,7,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,4,2  3,1  2,1  2,1
2,1,2,2,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,4,0
1251,1251,9,9,1,1,1,1,1,1,0,0,0,0,0,0,4,4,1,1,2,1,2,2,2,2  3  4,2  3
4,2  3  4,1  0,1  0,1,1  0,0,,,,,,,,,,,99,,,9  10,10,8  9  10
1679,1679,4  5  6,9,0,0,0,0,0,0,0,0,0,0,0,0,2  3  4,3  4,3  4,1  3,1
3,1  3,1,9,,,,,,,,,,,,,1,1  0,,,,1,1  0,6  7  8,5  6  10,5  6  7  10,5
6,5  6  10,4  10
1732,1732,5  6,7,1,1,1,1,1,1,0,0,0,0,0,0,2
4,3,3,3,3,3,2,2,2,2,2,2,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0

--
-
Govind Acharya
Assistant Director/Senior Research Associate
Survey Research Institute, Cornell University
391 Pine Tree Rd.
Ithaca, NY 14850
phone: (607) 255-0375; fax: (607) 255-7118
http://www.sri.cornell.edu
Reply | Threaded
Open this post in threaded view
|

Re: multiple responses coded into something else

Govind Acharya
Thanks very much.  That did the trick!

Govind

-
Govind Acharya
Assistant Director/Senior Research Associate
Survey Research Institute, Cornell University
391 Pine Tree Rd.
Ithaca, NY 14850
phone: (607) 255-0375; fax: (607) 255-7118
http://www.sri.cornell.edu



Daniel E WILLIAMS wrote:

> Try using the INDEX function as follows (shown for the variable SURVBAR):
>
> GET DATA  /TYPE = TXT
>  /FILE = 'raw_data.csv'
>  /DELCASE = LINE
>  /DELIMITERS = ","
>  /ARRANGEMENT = DELIMITED
>  /FIRSTCASE = 2
>  /IMPORTCASE = ALL
>  /VARIABLES =
>  CASEID F4.0
>  SURVBAR A8
>  RESYR A7
>  RESYRCA A4
>  RSDT00 F1.0
>  RSDT01 A4
>  RSDT02 F1.0
>  RSDT03 F1.0
>  RSDT04 F1.0
>  RSDT05 F1.0
>  RENT6M F1.0
>  RENT3 F1.0
>  RENT5 F1.0
>  RENT12 F1.0
>  RENT30 F1.0
>  RENTNOW F1.0
>  RURL6M A7
>  RURL3 A4
>  RURL5 A4
>  RURL12 A4
>  RURL30 A5
>  RURLNOW A4
>  BEDR6M A8
>  BEDR3 A7
>  BEDR5 A8
>  BEDR12 A11
>  BEDR30 A4
>  BEDRNOW F1.0
>  DAYC6M F1.0
>  DAYC3 F1.0
>  DAYC5 F1.0
>  PET6M F1.0
>  PET3 F1.0
>  PET5 F1.0
>  PET12 F1.0
>  PET30 F1.0
>  PETNOW F1.0
>  HOOF6M F1.0
>  HOOF3 F1.0
>  HOOF5 F1.0
>  HOOF12 F1.0
>  HOOF30 F1.0
>  HOOFNOW F1.0
>  MEDBABW F1.0
>  MEDASPW F1.0
>  MEDIBUW F1.0
>  MEDOTHW F1.0
>  MEDCOXW F1.0
>  MEDACEW F1.0
>  .
> CACHE.
> EXECUTE.
> DATASET NAME DataSet1 WINDOW=FRONT.
>
> STRING new_SURVBAR (a8).
> COMPUTE new_SURVBAR = SURVBAR.
> IF INDEX(RTRIM(LTRIM(SURVBAR)), ' ') > 0 new_SURVBAR = '88'.
> EXECUTE.
>
> I hope this helps.
>
>
>
> Dan Williams
> Forecasting, Research and Analysis Office
> Department of Human Services
> State of Oregon, USA
> 503 947 5354
>
> >>> "Govind Acharya" <[hidden email]> 8/9/2007 8:57:16 AM >>>
> Hi all,
>
> I have a dataset (which is partially reproduced as csv text below) that
> has multiple responses separated by two spaces (saved as a string).  For
> example, variable X might have "  8  9" in one obs but "2  3  4"  in
> another.  This is done on purpose, because I am checking to test the
> accuracy of scanning software.  What I would like to recode this as
> '88', which is not a missing variable, but rather coded so that we can
> no that it is a multiple answer observation.  Is there a way that is
> general enough that SPSS would say that if there is this combination,
> then it will replace with '88'.  Thanks in advance your assistance.
>
> Govind
>
> CASEID,SURVBAR,RESYR,RESYRCA,RSDT00,RSDT01,RSDT02,RSDT03,RSDT04,RSDT05,RENT6M,RENT3,RENT5,RENT12,RENT30,RENTNOW,RURL6M,RURL3,RURL5,RURL12,RURL30,RURLNOW,BEDR6M,BEDR3,BEDR5,BEDR12,BEDR30,BEDRNOW,DAYC6M,DAYC3,DAYC5,PET6M,PET3,PET5,PET12,PET30,PETNOW,HOOF6M,HOOF3,HOOF5,HOOF12,HOOF30,HOOFNOW,MEDBABW,MEDASPW,MEDIBUW,MEDOTHW,MEDCOXW,MEDACEW
> 897,897,3,7,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,4,2  3,1  2,1  2,1
> 2,1,2,2,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,4,0
> 1251,1251,9,9,1,1,1,1,1,1,0,0,0,0,0,0,4,4,1,1,2,1,2,2,2,2  3  4,2  3
> 4,2  3  4,1  0,1  0,1,1  0,0,,,,,,,,,,,99,,,9  10,10,8  9  10
> 1679,1679,4  5  6,9,0,0,0,0,0,0,0,0,0,0,0,0,2  3  4,3  4,3  4,1  3,1
> 3,1  3,1,9,,,,,,,,,,,,,1,1  0,,,,1,1  0,6  7  8,5  6  10,5  6  7  10,5
> 6,5  6  10,4  10
> 1732,1732,5  6,7,1,1,1,1,1,1,0,0,0,0,0,0,2
> 4,3,3,3,3,3,2,2,2,2,2,2,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0
>
> --
> -
> Govind Acharya
> Assistant Director/Senior Research Associate
> Survey Research Institute, Cornell University
> 391 Pine Tree Rd.
> Ithaca, NY 14850
> phone: (607) 255-0375; fax: (607) 255-7118
> http://www.sri.cornell.edu
>