Welcome, Guest
Username: Password: Remember me

TOPIC: create "indexes"

create "indexes" 2 years 1 week ago #86609

  • adishardis
  • adishardis's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 58
  • Karma: 0
Hi,

I'm wondering if it's possible to have a field that autocalculates its value depending on previous answers of the respondent.

Maybe something lika a hidden question that just calculates the value. In spss I calculate it like this:

COMPUTE index1 = 0 .
EXECUTE .
DO IF (e5=1 or e15=1 or e15=2) .
COMPUTE
index1 = 1 .
END IF .
EXECUTE .

COMPUTE index2 = 0 .
EXECUTE .
DO IF (index1=1 and (e7=1 or e7=2 or e7=3)) .
COMPUTE
index2 = 1 .
END IF .
EXECUTE .

Sinceraly
Adam
Last Edit: 2 years 1 week ago by adishardis. Reason: unclear phrasing
The administrator has disabled public write access.

Re: create "indexes" 2 years 1 week ago #86625

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
I'm not well versed in SPSS syntax, but it looks like you're trying to do this:

index1:
{if(e5==1 or e15==1 or e15==2,1,0)}

index2:
{if(index1==1 and (e7==1 or e7==2 or e7==3),1,0)}

If so, create hidden Equation type questions for index1 and index2 and put the associated code in the question field. The values will be auto-updated as the user changes responses; and the resulting values will be stored to the database in variables index1 and index2.
Last Edit: 2 years 1 week ago by TMSWhite.
The administrator has disabled public write access.

Re: create "indexes" 2 years 1 week ago #86626

  • adishardis
  • adishardis's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 58
  • Karma: 0
Thank you, that seems to be exactly what i'm after!
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.196 seconds
Donation Image