There is no particular command in SPSS to develop dummy variables in the , however various transformation commandshelp you to produce such variables, namely the various creates of the Recode command, as well as conditionaltransformations.
You are watching: How to create dummy variables in spss
Below you will uncover some instances using these framework to create dummy variables.
A fake variable is a change that deserve to take 2 values, 1 (presence of one attribute) 0 (absence). You should yet beaware that the reality that in SPSS this is no necessarily true, together there is also the possibility that a worth is in reality missing; thisis no a difficulty when you are using dummy variables in your analysis as missing values space by default automatically excluded, butwhen you develop dummies using changes you must be careful and also know what girlfriend want, i.e. A missing value in the originalvariable need to it simply gain a worth of 0 (not having actually the attribute) or have to it missing.
Example 1: Dummies native categorical variables
Using command language friend would have to write:
RECODE Continent (1=1) (else=0) right into AsianCountry.Note that if one or several countries had a lacking value ~ above the Continent variable, its value onAsianCountry will be 0, i.e. A non-asian country. If this is no what girlfriend want, you require toadd further specifications dealing particularly with the lacking cases.
You might additionally use to: an initial create a brand-new variable AsianCountrywith all values 0, then assign 1 come it, yet only for eastern countries. This is quite cumbersome making use of menus, particularly if you have to create an ext than one fake variable; command language is much easier here:
COMPUTE AsianCountry=0.IF (Continent=1) AsianCountry=1.Important:Make sure to know that if girlfriend omit the an initial command, i.e. You only execute (assuming that AsianCountrydoes not yet exist in the energetic dataset):IF (Continent=1) AsianCountry=1.SPSS will create a brand-new variable, where oriental countries have actually a value of 1, but all other nations will it is in missing, i.e. SYSMIS!
Example 2: Dummies native a constant variable
Assume that you would prefer to develop a fake variable AgriCountry, where0 is a nation where farming is less necessary (based ~ above the criterion that AgriGDP (% of GDPproduced in farming is listed below the mean of all countries (22.9), and also 1 a nation where farming is crucial (AgriGDP above the mean.
See more: Im Worth It Meme (Read Desc), Baby I'M Worth It! Meme(Read Desc)
Using command language friend can achieve the very same by executing:
RECODE AgriGDP (LOWEST THRU 22.9=1) (ELSE=0) right into AgriCountry.Using the IF command you have the right to do the same with:
COMPUTE AgriCountry=0IF (AgriGDP The same can be accomplished with this command
Using the IF command you have the right to do the very same with:
COMPUTE AgriCountry=AgriGDP This creates a variable with value that 1 if the problem is true and 0 if the problem is false.(In SPSS logical values are stood for by 0/1 (false/true).