SPSS Conjoint Problems

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

SPSS Conjoint Problems

Yusof ahmad
I have specified the following syntax
CONJOINT PLAN = 'FILE NAME'
 /DATA = 'FILENAME'
 /SEQUENCE = PROFILE1 TO PROFILE10
 /SUBJECT = SN
 /FACTORS = PRICE(LINEAR LESS)FACTOR1(DISCRETE MORE) FACTOR2(DISCRETE MORE)
 /SCORE =  1 TO 100
 /PRINT = ALL.


Also in my plan, all factor levels are numbered and the factor variables
are numeric variables.
I get the following error messages:

Warnings
FACTOR SUBCOMMAND -- Invalid keyword or a non-numeric factor level value
encountered. Only numeric factor level values are allowed.
This command is not executed.
Repeated subcommand or keyword.
Text: 1
Unrecognized text was found where a variable list was expected.

Unrecognized text appears where end of subcommand (slash) was expected.

what on earth does all this mean? there is repeated sub-command, all sub-
commands end with slash and all my factors have numeric values in the
datafile.
Reply | Threaded
Open this post in threaded view
|

Re:SPSS Conjoint Problems

Jerabek Jindrich
Hello,

I would try to rename the variables factor1 and factor2.
The names are similar to the keyword FACTORS, there could be a conflict - maybe SPSS reads the variable name as a one more FACTORS subcommand.

HTH
Jindra

> ------------ Původní zpráva ------------
> Od: Yusof ahmad <[hidden email]>
> Předmět: SPSS Conjoint Problems
> Datum: 13.4.2007 22:11:08
> ----------------------------------------
> I have specified the following syntax
> CONJOINT PLAN = 'FILE NAME'
>  /DATA = 'FILENAME'
>  /SEQUENCE = PROFILE1 TO PROFILE10
>  /SUBJECT = SN
>  /FACTORS = PRICE(LINEAR LESS)FACTOR1(DISCRETE MORE) FACTOR2(DISCRETE MORE)
>  /SCORE =  1 TO 100
>  /PRINT = ALL.
>
>
> Also in my plan, all factor levels are numbered and the factor variables
> are numeric variables.
> I get the following error messages:
>
> Warnings
> FACTOR SUBCOMMAND -- Invalid keyword or a non-numeric factor level value
> encountered. Only numeric factor level values are allowed.
> This command is not executed.
> Repeated subcommand or keyword.
> Text: 1
> Unrecognized text was found where a variable list was expected.
>
> Unrecognized text appears where end of subcommand (slash) was expected.
>
> what on earth does all this mean? there is repeated sub-command, all sub-
> commands end with slash and all my factors have numeric values in the
> datafile.
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: SPSS Conjoint Problems

Yusof ahmad
Hi all,

This problem was resolved. Problem with my syntax.

Regards,
Yusof

-----Original Message-----
From: Jerabek Jindrich [mailto:[hidden email]]
Sent: Saturday, April 14, 2007 4:34 AM
To: Yusof Ahmad
Cc: [hidden email]
Subject: Re:SPSS Conjoint Problems

Hello,

I would try to rename the variables factor1 and factor2.
The names are similar to the keyword FACTORS, there could be a conflict - maybe SPSS reads the variable name as a one more FACTORS subcommand.

HTH
Jindra

> ------------ Původní zpráva ------------
> Od: Yusof ahmad <[hidden email]>
> Předmět: SPSS Conjoint Problems
> Datum: 13.4.2007 22:11:08
> ----------------------------------------
> I have specified the following syntax
> CONJOINT PLAN = 'FILE NAME'
>  /DATA = 'FILENAME'
>  /SEQUENCE = PROFILE1 TO PROFILE10
>  /SUBJECT = SN
>  /FACTORS = PRICE(LINEAR LESS)FACTOR1(DISCRETE MORE) FACTOR2(DISCRETE MORE)
>  /SCORE =  1 TO 100
>  /PRINT = ALL.
>
>
> Also in my plan, all factor levels are numbered and the factor variables
> are numeric variables.
> I get the following error messages:
>
> Warnings
> FACTOR SUBCOMMAND -- Invalid keyword or a non-numeric factor level value
> encountered. Only numeric factor level values are allowed.
> This command is not executed.
> Repeated subcommand or keyword.
> Text: 1
> Unrecognized text was found where a variable list was expected.
>
> Unrecognized text appears where end of subcommand (slash) was expected.
>
> what on earth does all this mean? there is repeated sub-command, all sub-
> commands end with slash and all my factors have numeric values in the
> datafile.
>
>
>


The information in this e-mail is the property of Evalueserve and is confidential and privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and will be unlawful. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
Reply | Threaded
Open this post in threaded view
|

a very difficult programming query to say the least!!!!

paulandpen
hi listers,

i have a set of cases laid out in the format below

ncs_id    choice    longover    maifover    saifover    qualover    setid
1                1            2                3            3
2            11
1                1            1                2            3
2            14
1                2            2                2            3
2            17
1                1            2                3            2
2            29
1                1            1                2            3
2            32
1                2            2                2            3
2            45
1                1            1                2            3
2            17
1                2            2                2            3
2            71

each case has 8 id ncs_id points and a set of corresponding values next to
it
I need to add 12 more cases along with a new group of setids for each case
each case has a random set of 8 values out of a possible 20 and the values
corresponding to each case can take any one of the following values

setid
11.00
14.00
17.00
29.00
32.00
35.00
37.00
38.00
39.00
40.00
41.00
42.00
43.00
44.00
45.00
47.00
50.00
53.00
65.00
68.00
71.00

i want to add 12 new cases conditional on what is already contained in each
batch of cases
say case 1 has 8 setids i could add the 12 ids with a case =1 and setid =
all the remaining setids missing above

any help would be appreciated
regards paul
Reply | Threaded
Open this post in threaded view
|

Re: a very difficult programming query to say the least!!!!

George Emerson D'Umbra
Paul,

what happens when a setid is duplicated? - like '17' in your sample.

regards,
George

----- Original Message -----
From: "paulandpen" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, April 17, 2007 10:34 AM
Subject: a very difficult programming query to say the least!!!!


> hi listers,
>
> i have a set of cases laid out in the format below
>
> ncs_id    choice    longover    maifover    saifover    qualover    setid
> 1                1            2                3            3
> 2            11
> 1                1            1                2            3
> 2            14
> 1                2            2                2            3
> 2            17
> 1                1            2                3            2
> 2            29
> 1                1            1                2            3
> 2            32
> 1                2            2                2            3
> 2            45
> 1                1            1                2            3
> 2            17
> 1                2            2                2            3
> 2            71
>
> each case has 8 id ncs_id points and a set of corresponding values next to
> it
> I need to add 12 more cases along with a new group of setids for each case
> each case has a random set of 8 values out of a possible 20 and the values
> corresponding to each case can take any one of the following values
>
> setid
> 11.00
> 14.00
> 17.00
> 29.00
> 32.00
> 35.00
> 37.00
> 38.00
> 39.00
> 40.00
> 41.00
> 42.00
> 43.00
> 44.00
> 45.00
> 47.00
> 50.00
> 53.00
> 65.00
> 68.00
> 71.00
>
> i want to add 12 new cases conditional on what is already contained in
> each
> batch of cases
> say case 1 has 8 setids i could add the 12 ids with a case =1 and setid =
> all the remaining setids missing above
>
> any help would be appreciated
> regards paul
Reply | Threaded
Open this post in threaded view
|

Re: a very difficult programming query to say the least!!!!

paulandpen
George

Thanks for that, I would like to code the second replicated value as missing
as well because I need to set this up for latent gold choice

Regards Paul
----- Original Message -----
From: "George Emerson D'Umbra" <[hidden email]>
To: "paulandpen" <[hidden email]>; <[hidden email]>
Sent: Wednesday, April 18, 2007 12:08 AM
Subject: Re: a very difficult programming query to say the least!!!!


> Paul,
>
> what happens when a setid is duplicated? - like '17' in your sample.
>
> regards,
> George
>
> ----- Original Message -----
> From: "paulandpen" <[hidden email]>
> To: <[hidden email]>
> Sent: Tuesday, April 17, 2007 10:34 AM
> Subject: a very difficult programming query to say the least!!!!
>
>
>> hi listers,
>>
>> i have a set of cases laid out in the format below
>>
>> ncs_id    choice    longover    maifover    saifover    qualover    setid
>> 1                1            2                3            3
>> 2            11
>> 1                1            1                2            3
>> 2            14
>> 1                2            2                2            3
>> 2            17
>> 1                1            2                3            2
>> 2            29
>> 1                1            1                2            3
>> 2            32
>> 1                2            2                2            3
>> 2            45
>> 1                1            1                2            3
>> 2            17
>> 1                2            2                2            3
>> 2            71
>>
>> each case has 8 id ncs_id points and a set of corresponding values next
>> to
>> it
>> I need to add 12 more cases along with a new group of setids for each
>> case
>> each case has a random set of 8 values out of a possible 20 and the
>> values
>> corresponding to each case can take any one of the following values
>>
>> setid
>> 11.00
>> 14.00
>> 17.00
>> 29.00
>> 32.00
>> 35.00
>> 37.00
>> 38.00
>> 39.00
>> 40.00
>> 41.00
>> 42.00
>> 43.00
>> 44.00
>> 45.00
>> 47.00
>> 50.00
>> 53.00
>> 65.00
>> 68.00
>> 71.00
>>
>> i want to add 12 new cases conditional on what is already contained in
>> each
>> batch of cases
>> say case 1 has 8 setids i could add the 12 ids with a case =1 and setid =
>> all the remaining setids missing above
>>
>> any help would be appreciated
>> regards paul
>
>
Reply | Threaded
Open this post in threaded view
|

Re: a very difficult programming query to say the least!!!!

Richard Ristow
In reply to this post by paulandpen
At 09:34 AM 4/17/2007, paulandpen wrote:

>i have a set of cases laid out in the format below

Which I repeat below, shortening lines so it can be read. (General
note: avoid posting lines longer than 72 characters; the list remailer
will wrap them at 72, and they can become very difficult to read.)

>ncs_id  choice  longover  maifover  saifover  qualover  setid
>    1       1      2         3         3         2        11
>    1       1      1         2         3         2        14
>    1       2      2         2         3         2        17
>    1       1      2         3         2         2        29
>    1       1      1         2         3         2        32
>    1       2      2         2         3         2        45
>    1       1      1         2         3         2        17
>    1       2      2         2         3         2        71
>
>each case has 8 id ncs_id points and a set of corresponding values
>next to
>it

That is, your 'case' (conceptually) has 8 'cases' or 'records' (in SPSS
terms), and variable "ncd_id" identifies your 'case', i.e. the 8 record
in its set. Right so far? (Might have been worth posting two cases. As
it is, I'm guessing.)

Here's where it gets very obscure. I'm sorry to say so, but your
description of what you want is very poorly written. It matters for us,
but it should matter for you, too. In solving "a very difficult
programming query", or any programming problem, a first crucial step is
understanding exactly what you want to accomplish.

>I need to add 12 more cases

'Case' in your sense, 8 records each, or in the SPSS sense - i.e., 12
more records? I thought, the former. Now, reading below, I think the
latter.

Are you adding these cases from a source of data you have, or
constructing them at random? Or creating them, according to some
criterion?

>along with a new group of setids for each case

OK:

>each case has a random set of 8 values out of a possible 20 and the
>values [of "setid" - as you should have said explicitly] corresponding
>to each case can take any one of the following [21] values.

11.00 14.00 17.00 29.00 32.00
35.00 37.00 38.00 39.00 40.00
41.00 42.00 43.00 44.00 45.00
47.00 50.00 53.00 65.00 68.00
71.00

*NOW* it looks like you're adding 12 'cases' (each identified by a
value of "ncs_id") *and* enough record to each 'case' that there's one
with each value of "setid" on the list you gave (and I'm

>i want to add 12 new cases conditional on what is already contained in
>each
>batch of cases say case 1 has 8 setids i could add the 12 ids with a
>case =1 and setid = all the remaining setids missing above

Now I'm going to stop conjecturing, and let you clarify. In clarifying,
be consistent in using the word "case" - is it a set of records
identified by a value of "ncs_id"? Or a single record? Or what? But
whatever you choose, use it in that sense, and only that sense, in what
you write.
Reply | Threaded
Open this post in threaded view
|

Re: a very difficult programming query to say the least!!!!

paulandpen
sincerest apologies Richard and other list members!!!!!

i have a reflux child etc and am so sleep deprived it is not funny (it is
1am here) and I am driven by client deliverables to get this finished

here is my problem more clearly laid out (hopefully)

I have a datafile structured in the following way
1.  There are seven variables listed across the top in 7 columns
2.  The first column 'ncs_id' is an id number denoting a person
3.  Each individual person currently has 8 id numbers
4. These are laid out one under each other (see example below)

ncs_id
1 (person 1)
1 (person 1)
1 (person 1)
1 (person 1)
1 (person 1)
1 (person 1)
1 (person 1)
1 (person 1)
2 (person 2)
2 (person 2)
2 (person 2)
2 (person 2)
2 (person 2)
2 (person 2)
2 (person 2)
2 (person 2)

4. Each person  is also assigned a set_id that corresponds to each of their
8 ncs_id

The example here is shortened to just a snapshot of two examples of an
ncs_id corresponding to a set_id for two people
ncs_id    set_id
1                11
1                14
2                11
2                17

The set id refers to a random task they were presented with
Each person completed 8 random tasks out of a possible 20
The scope of the random tasks is listed here below

11.00 14.00 17.00 29.00 32.00
> 35.00 37.00 38.00 39.00 40.00
> 41.00 42.00 43.00 44.00 45.00
> 47.00 50.00 53.00 65.00 68.00
> 71.00

I need to generate additional values (12 in fact) for each person
This will mean that each person will then have
20 ncs_id values and 20 set_id values

What stumps me is how to add new set_ids to each ncs_id because this task is
conditional on the set_ids they already have

What I would like to do is this:

Existing situation
ncs_id    set_id
1                11
1                29

New situation
ncs_id    set_id
1                11
1                14
1                17
1                29

See that 14 and 17 were added in

followed by

Existing situation
ncs_id    set_id
2                14
2                29

New situation
ncs_id    set_id
2                11
2                14
2                17
2               29

See that 11 and 17 were added in

And so on........ for 500+ individuals

Thanks if anyone is still willing to help????

Paul

----- Original Message -----
From: "Richard Ristow" <[hidden email]>
To: "paulandpen" <[hidden email]>; <[hidden email]>
Sent: Wednesday, April 18, 2007 12:39 AM
Subject: Re: a very difficult programming query to say the least!!!!


> At 09:34 AM 4/17/2007, paulandpen wrote:
>
>>i have a set of cases laid out in the format below
>
> Which I repeat below, shortening lines so it can be read. (General note:
> avoid posting lines longer than 72 characters; the list remailer will wrap
> them at 72, and they can become very difficult to read.)
>
>>ncs_id  choice  longover  maifover  saifover  qualover  setid
>>    1       1      2         3         3         2        11
>>    1       1      1         2         3         2        14
>>    1       2      2         2         3         2        17
>>    1       1      2         3         2         2        29
>>    1       1      1         2         3         2        32
>>    1       2      2         2         3         2        45
>>    1       1      1         2         3         2        17
>>    1       2      2         2         3         2        71
>>
>>each case has 8 id ncs_id points and a set of corresponding values next to
>>it
>
> That is, your 'case' (conceptually) has 8 'cases' or 'records' (in SPSS
> terms), and variable "ncd_id" identifies your 'case', i.e. the 8 record in
> its set. Right so far? (Might have been worth posting two cases. As it is,
> I'm guessing.)
>
> Here's where it gets very obscure. I'm sorry to say so, but your
> description of what you want is very poorly written. It matters for us,
> but it should matter for you, too. In solving "a very difficult
> programming query", or any programming problem, a first crucial step is
> understanding exactly what you want to accomplish.
>
>>I need to add 12 more cases
>
> 'Case' in your sense, 8 records each, or in the SPSS sense - i.e., 12 more
> records? I thought, the former. Now, reading below, I think the latter.
>
> Are you adding these cases from a source of data you have, or constructing
> them at random? Or creating them, according to some criterion?
>
>>along with a new group of setids for each case
>
> OK:
>
>>each case has a random set of 8 values out of a possible 20 and the values
>>[of "setid" - as you should have said explicitly] corresponding to each
>>case can take any one of the following [21] values.
>
> 11.00 14.00 17.00 29.00 32.00
> 35.00 37.00 38.00 39.00 40.00
> 41.00 42.00 43.00 44.00 45.00
> 47.00 50.00 53.00 65.00 68.00
> 71.00
>
> *NOW* it looks like you're adding 12 'cases' (each identified by a value
> of "ncs_id") *and* enough record to each 'case' that there's one with each
> value of "setid" on the list you gave (and I'm
>
>>i want to add 12 new cases conditional on what is already contained in
>>each
>>batch of cases say case 1 has 8 setids i could add the 12 ids with a case
>>=1 and setid = all the remaining setids missing above
>
> Now I'm going to stop conjecturing, and let you clarify. In clarifying, be
> consistent in using the word "case" - is it a set of records identified by
> a value of "ncs_id"? Or a single record? Or what? But whatever you choose,
> use it in that sense, and only that sense, in what you write.
>
Reply | Threaded
Open this post in threaded view
|

Re: a very difficult programming query to say the least!!!!

George Emerson D'Umbra
Try this:

dataset name original.

DATASET COPY copia WINDOW=FRONT.

dataset activate copia.

recode setid (11=1) (14=2) (17=3) (29=4) (32=5) (35=6) (37=7) (38=8) (39=9)

(40=10) (41=11) (42=12) (43=13) (44=14) (45=15) (47=16) (50=17) (53=18)

(65=19) (68=20) (71=21) into rec_set.

exec.

del var choice to setid.

SORT CASES BY ncs_id .

CASESTOVARS

/ID = ncs_id

/GROUPBY = VARIABLE.

vector v(21) /r_s = rec_set.1 to rec_set.8.

loop #I=1 to 21.

compute v(#I) = #I.

end loop.

loop #I=1 to 8.

compute v(r_s(#I))=$SYSMIS.

end loop.

VARSTOCASES /MAKE setid FROM v1 to v21

/KEEP = ncs_id

/NULL = DROP.

recode setid (1=11) (2=14) (3=17) (4=29) (5=32) (6=35) (7=37) (8=38) (9=39)

(10=40) (11=41) (12=42) (13=43) (14=44) (15=45) (16=47) (17=50) (18=53)

(19=65) (20=68) (21=71).

ADD FILES /FILE=*

/FILE='original'.



SORT CASES BY

ncs_id (A) setid (A) .



----- Original Message -----
From: "paulandpen" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, April 17, 2007 12:18 PM
Subject: Re: a very difficult programming query to say the least!!!!


> sincerest apologies Richard and other list members!!!!!
>
> i have a reflux child etc and am so sleep deprived it is not funny (it is
> 1am here) and I am driven by client deliverables to get this finished
>
> here is my problem more clearly laid out (hopefully)
>
> I have a datafile structured in the following way
> 1.  There are seven variables listed across the top in 7 columns
> 2.  The first column 'ncs_id' is an id number denoting a person
> 3.  Each individual person currently has 8 id numbers
> 4. These are laid out one under each other (see example below)
>
> ncs_id
> 1 (person 1)
> 1 (person 1)
> 1 (person 1)
> 1 (person 1)
> 1 (person 1)
> 1 (person 1)
> 1 (person 1)
> 1 (person 1)
> 2 (person 2)
> 2 (person 2)
> 2 (person 2)
> 2 (person 2)
> 2 (person 2)
> 2 (person 2)
> 2 (person 2)
> 2 (person 2)
>
> 4. Each person  is also assigned a set_id that corresponds to each of
> their
> 8 ncs_id
>
> The example here is shortened to just a snapshot of two examples of an
> ncs_id corresponding to a set_id for two people
> ncs_id    set_id
> 1                11
> 1                14
> 2                11
> 2                17
>
> The set id refers to a random task they were presented with
> Each person completed 8 random tasks out of a possible 20
> The scope of the random tasks is listed here below
>
> 11.00 14.00 17.00 29.00 32.00
>> 35.00 37.00 38.00 39.00 40.00
>> 41.00 42.00 43.00 44.00 45.00
>> 47.00 50.00 53.00 65.00 68.00
>> 71.00
>
> I need to generate additional values (12 in fact) for each person
> This will mean that each person will then have
> 20 ncs_id values and 20 set_id values
>
> What stumps me is how to add new set_ids to each ncs_id because this task
> is
> conditional on the set_ids they already have
>
> What I would like to do is this:
>
> Existing situation
> ncs_id    set_id
> 1                11
> 1                29
>
> New situation
> ncs_id    set_id
> 1                11
> 1                14
> 1                17
> 1                29
>
> See that 14 and 17 were added in
>
> followed by
>
> Existing situation
> ncs_id    set_id
> 2                14
> 2                29
>
> New situation
> ncs_id    set_id
> 2                11
> 2                14
> 2                17
> 2               29
>
> See that 11 and 17 were added in
>
> And so on........ for 500+ individuals
>
> Thanks if anyone is still willing to help????
>
> Paul
>
> ----- Original Message -----
> From: "Richard Ristow" <[hidden email]>
> To: "paulandpen" <[hidden email]>; <[hidden email]>
> Sent: Wednesday, April 18, 2007 12:39 AM
> Subject: Re: a very difficult programming query to say the least!!!!
>
>
>> At 09:34 AM 4/17/2007, paulandpen wrote:
>>
>>>i have a set of cases laid out in the format below
>>
>> Which I repeat below, shortening lines so it can be read. (General note:
>> avoid posting lines longer than 72 characters; the list remailer will
>> wrap
>> them at 72, and they can become very difficult to read.)
>>
>>>ncs_id  choice  longover  maifover  saifover  qualover  setid
>>>    1       1      2         3         3         2        11
>>>    1       1      1         2         3         2        14
>>>    1       2      2         2         3         2        17
>>>    1       1      2         3         2         2        29
>>>    1       1      1         2         3         2        32
>>>    1       2      2         2         3         2        45
>>>    1       1      1         2         3         2        17
>>>    1       2      2         2         3         2        71
>>>
>>>each case has 8 id ncs_id points and a set of corresponding values next
>>>to
>>>it
>>
>> That is, your 'case' (conceptually) has 8 'cases' or 'records' (in SPSS
>> terms), and variable "ncd_id" identifies your 'case', i.e. the 8 record
>> in
>> its set. Right so far? (Might have been worth posting two cases. As it
>> is,
>> I'm guessing.)
>>
>> Here's where it gets very obscure. I'm sorry to say so, but your
>> description of what you want is very poorly written. It matters for us,
>> but it should matter for you, too. In solving "a very difficult
>> programming query", or any programming problem, a first crucial step is
>> understanding exactly what you want to accomplish.
>>
>>>I need to add 12 more cases
>>
>> 'Case' in your sense, 8 records each, or in the SPSS sense - i.e., 12
>> more
>> records? I thought, the former. Now, reading below, I think the latter.
>>
>> Are you adding these cases from a source of data you have, or
>> constructing
>> them at random? Or creating them, according to some criterion?
>>
>>>along with a new group of setids for each case
>>
>> OK:
>>
>>>each case has a random set of 8 values out of a possible 20 and the
>>>values
>>>[of "setid" - as you should have said explicitly] corresponding to each
>>>case can take any one of the following [21] values.
>>
>> 11.00 14.00 17.00 29.00 32.00
>> 35.00 37.00 38.00 39.00 40.00
>> 41.00 42.00 43.00 44.00 45.00
>> 47.00 50.00 53.00 65.00 68.00
>> 71.00
>>
>> *NOW* it looks like you're adding 12 'cases' (each identified by a value
>> of "ncs_id") *and* enough record to each 'case' that there's one with
>> each
>> value of "setid" on the list you gave (and I'm
>>
>>>i want to add 12 new cases conditional on what is already contained in
>>>each
>>>batch of cases say case 1 has 8 setids i could add the 12 ids with a case
>>>=1 and setid = all the remaining setids missing above
>>
>> Now I'm going to stop conjecturing, and let you clarify. In clarifying,
>> be
>> consistent in using the word "case" - is it a set of records identified
>> by
>> a value of "ncs_id"? Or a single record? Or what? But whatever you
>> choose,
>> use it in that sense, and only that sense, in what you write.
>>
Reply | Threaded
Open this post in threaded view
|

Re: a very difficult programming query to say the least!!!!

Mike P-5
In reply to this post by paulandpen
I like that solution,

Programmatically with python, by using the autorecode and reverse recode
functions this would enable the solution to be less hard coded, and of
course loops are easier to programme,

But as this is a one off project I shall let others investigate this
solution on there own

Mike

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
George Emerson D'Umbra
Sent: 17 April 2007 16:52
To: [hidden email]
Subject: Re: a very difficult programming query to say the least!!!!

Try this:

dataset name original.

DATASET COPY copia WINDOW=FRONT.

dataset activate copia.

recode setid (11=1) (14=2) (17=3) (29=4) (32=5) (35=6) (37=7) (38=8)
(39=9)

(40=10) (41=11) (42=12) (43=13) (44=14) (45=15) (47=16) (50=17) (53=18)

(65=19) (68=20) (71=21) into rec_set.

exec.

del var choice to setid.

SORT CASES BY ncs_id .

CASESTOVARS

/ID = ncs_id

/GROUPBY = VARIABLE.

vector v(21) /r_s = rec_set.1 to rec_set.8.

loop #I=1 to 21.

compute v(#I) = #I.

end loop.

loop #I=1 to 8.

compute v(r_s(#I))=$SYSMIS.

end loop.

VARSTOCASES /MAKE setid FROM v1 to v21

/KEEP = ncs_id

/NULL = DROP.

recode setid (1=11) (2=14) (3=17) (4=29) (5=32) (6=35) (7=37) (8=38)
(9=39)

(10=40) (11=41) (12=42) (13=43) (14=44) (15=45) (16=47) (17=50) (18=53)

(19=65) (20=68) (21=71).

ADD FILES /FILE=*

/FILE='original'.



SORT CASES BY

ncs_id (A) setid (A) .



----- Original Message -----
From: "paulandpen" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, April 17, 2007 12:18 PM
Subject: Re: a very difficult programming query to say the least!!!!


> sincerest apologies Richard and other list members!!!!!
>
> i have a reflux child etc and am so sleep deprived it is not funny (it
is

> 1am here) and I am driven by client deliverables to get this finished
>
> here is my problem more clearly laid out (hopefully)
>
> I have a datafile structured in the following way
> 1.  There are seven variables listed across the top in 7 columns
> 2.  The first column 'ncs_id' is an id number denoting a person
> 3.  Each individual person currently has 8 id numbers
> 4. These are laid out one under each other (see example below)
>
> ncs_id
> 1 (person 1)
> 1 (person 1)
> 1 (person 1)
> 1 (person 1)
> 1 (person 1)
> 1 (person 1)
> 1 (person 1)
> 1 (person 1)
> 2 (person 2)
> 2 (person 2)
> 2 (person 2)
> 2 (person 2)
> 2 (person 2)
> 2 (person 2)
> 2 (person 2)
> 2 (person 2)
>
> 4. Each person  is also assigned a set_id that corresponds to each of
> their
> 8 ncs_id
>
> The example here is shortened to just a snapshot of two examples of an
> ncs_id corresponding to a set_id for two people
> ncs_id    set_id
> 1                11
> 1                14
> 2                11
> 2                17
>
> The set id refers to a random task they were presented with
> Each person completed 8 random tasks out of a possible 20
> The scope of the random tasks is listed here below
>
> 11.00 14.00 17.00 29.00 32.00
>> 35.00 37.00 38.00 39.00 40.00
>> 41.00 42.00 43.00 44.00 45.00
>> 47.00 50.00 53.00 65.00 68.00
>> 71.00
>
> I need to generate additional values (12 in fact) for each person
> This will mean that each person will then have
> 20 ncs_id values and 20 set_id values
>
> What stumps me is how to add new set_ids to each ncs_id because this
task

> is
> conditional on the set_ids they already have
>
> What I would like to do is this:
>
> Existing situation
> ncs_id    set_id
> 1                11
> 1                29
>
> New situation
> ncs_id    set_id
> 1                11
> 1                14
> 1                17
> 1                29
>
> See that 14 and 17 were added in
>
> followed by
>
> Existing situation
> ncs_id    set_id
> 2                14
> 2                29
>
> New situation
> ncs_id    set_id
> 2                11
> 2                14
> 2                17
> 2               29
>
> See that 11 and 17 were added in
>
> And so on........ for 500+ individuals
>
> Thanks if anyone is still willing to help????
>
> Paul
>
> ----- Original Message -----
> From: "Richard Ristow" <[hidden email]>
> To: "paulandpen" <[hidden email]>;
<[hidden email]>
> Sent: Wednesday, April 18, 2007 12:39 AM
> Subject: Re: a very difficult programming query to say the least!!!!
>
>
>> At 09:34 AM 4/17/2007, paulandpen wrote:
>>
>>>i have a set of cases laid out in the format below
>>
>> Which I repeat below, shortening lines so it can be read. (General
note:

>> avoid posting lines longer than 72 characters; the list remailer will
>> wrap
>> them at 72, and they can become very difficult to read.)
>>
>>>ncs_id  choice  longover  maifover  saifover  qualover  setid
>>>    1       1      2         3         3         2        11
>>>    1       1      1         2         3         2        14
>>>    1       2      2         2         3         2        17
>>>    1       1      2         3         2         2        29
>>>    1       1      1         2         3         2        32
>>>    1       2      2         2         3         2        45
>>>    1       1      1         2         3         2        17
>>>    1       2      2         2         3         2        71
>>>
>>>each case has 8 id ncs_id points and a set of corresponding values
next
>>>to
>>>it
>>
>> That is, your 'case' (conceptually) has 8 'cases' or 'records' (in
SPSS
>> terms), and variable "ncd_id" identifies your 'case', i.e. the 8
record
>> in
>> its set. Right so far? (Might have been worth posting two cases. As
it
>> is,
>> I'm guessing.)
>>
>> Here's where it gets very obscure. I'm sorry to say so, but your
>> description of what you want is very poorly written. It matters for
us,
>> but it should matter for you, too. In solving "a very difficult
>> programming query", or any programming problem, a first crucial step
is
>> understanding exactly what you want to accomplish.
>>
>>>I need to add 12 more cases
>>
>> 'Case' in your sense, 8 records each, or in the SPSS sense - i.e., 12
>> more
>> records? I thought, the former. Now, reading below, I think the
latter.

>>
>> Are you adding these cases from a source of data you have, or
>> constructing
>> them at random? Or creating them, according to some criterion?
>>
>>>along with a new group of setids for each case
>>
>> OK:
>>
>>>each case has a random set of 8 values out of a possible 20 and the
>>>values
>>>[of "setid" - as you should have said explicitly] corresponding to
each
>>>case can take any one of the following [21] values.
>>
>> 11.00 14.00 17.00 29.00 32.00
>> 35.00 37.00 38.00 39.00 40.00
>> 41.00 42.00 43.00 44.00 45.00
>> 47.00 50.00 53.00 65.00 68.00
>> 71.00
>>
>> *NOW* it looks like you're adding 12 'cases' (each identified by a
value
>> of "ncs_id") *and* enough record to each 'case' that there's one with
>> each
>> value of "setid" on the list you gave (and I'm
>>
>>>i want to add 12 new cases conditional on what is already contained
in
>>>each
>>>batch of cases say case 1 has 8 setids i could add the 12 ids with a
case
>>>=1 and setid = all the remaining setids missing above
>>
>> Now I'm going to stop conjecturing, and let you clarify. In
clarifying,
>> be
>> consistent in using the word "case" - is it a set of records
identified
>> by
>> a value of "ncs_id"? Or a single record? Or what? But whatever you
>> choose,
>> use it in that sense, and only that sense, in what you write.
>>

________________________________________________________________________
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
______________________________________________________________________