# Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

# how to generate 0-1 variable by fixed possibility

1 month 2 weeks ago #240059 by qiangqi
Your LimeSurvey version: [Limesurvey cloud 3.28.42]

Hi everyone,

in the first question, "how much possibility could you use the car of your household when you plan to go to a leisure activity, such as watching a movie, go to sports?" and the answers include 20%, 50%, and 80%. THEN, in the second question, I want to generate a 0-1 variable by the possibility got from the first question. Does anyone know whether it is possible to achieve it? Thanks for help in advance.

Best,
Qiang

1 month 2 weeks ago #240061 by Joffm
Which type of question do you want to use for this 0-1?

Volunteers are not paid.
Not because they are worthless, but because they are priceless

1 month 2 weeks ago #240064 by jelo
The question seem to be "What is the probability in percent that you use your household's car for a leisure activity (e.g. to watch a movie or go to sports)??"
Are there more than these three ( 20%, 50%, and 80%) answer items? What about 0% and 100%?

What is the purpose of the dichotomous (0,1) variable?

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

1 month 2 weeks ago #240069 by Joffm
Still rather clueless.
But a built in way to get  dichotomous variables out of a single punched question is:

Use a multiple question.
In the export settings there is the option to change the "Y", "" to whatever character you like.

Otherwise you have to use some equations, like
eq20: {if(Q1=="20",1,0)}
eq50: {if(Q1=="50",1,0)}
...

Or you set a hidden multiple question by equation. Result the same as above. In the export you select your desired values
Like
{M1_1={if(Q1=="20","Y","")}
{M1_2={if(Q1=="50","Y","")}
​​​​​​​...

Or you use a hidden question (multiple numbers) by equation.
Like
{M1_1={if(Q1=="20",1,0)}
{M1_2={if(Q1=="50",1,0)}
​​​​​​​...

As you see, there are several options.

(As we are not part of your TUE group who deals with the new ideas of public transportation, we have no idea what you want to achieve

Volunteers are not paid.
Not because they are worthless, but because they are priceless

1 month 2 weeks ago #240090 by holch
Like Jelo, find the question rather strange and I would guess that there is a very high probability that a family car will be used 100% for leisure activities for most respondents. Who has their family car just for work or chores?

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

1 month 2 weeks ago #240105 by qiangqi
Hi Joffm,

Sorry for the late response. Thanks for your help. I think your methods are useful for me. I want to explore which transport respondent prefer to choose under some uncertain purposes. in fact, the private mode may be occupied by others in your household and the alternative should not be shown. This is why I want to make the alternative of Private car appear with a possibility.

Best,
Qiang