Align: This is another aesthetic option which we don’t usually alter. Creating a New SPSS Dataset -- Variable Specification and Data Entry When you open SPSS you will see the Data Editor This shows the Data View of the editor. With regard to our test data, the syntax below shows how to convert numeric_1 into (previously created) string_3. Aggregated Variables are source variables used with aggregate functions to create new aggregate variables. F Function group: You can also use the built-in functions in the Function group list on the right-hand side of the window. One of the places that SPSS syntax excels at efficiency is when you’re creating new variables. Click on Change. Basically it is a series of commands which tell SPSS what to do. If you look at the commands you can see where you could make quick and easy edits to alter the process: VARIABLE LABELS is where the name and label are defined for example. Remember that even categorical variables are coded numerically. I have a data base of patients which contain multiple variables as yes=1, no=0. We are using the Range option because we are collapsing multiple values so that they are represented by one value (e.g. How do I create a sum of different variables in SPSS for Windows? If you click Paste after revising the formula, the following syntax will be written to the syntax editor window: A common scenario on health questionnaires is to have multiple questions about risk factors for a certain disease. We rarely use this! We have already seen that this can take a while! Simply type a name for the new variable in the text field. Resolving The Problem. Click the Old and New Values button. Notice how each line of syntax ends in a period. You can also Change or Remove the value labels you have already placed in the box. I want to create a new variable using the last scores of participants ... so I want to import only T3 score to a new variable. You will be presented with the pop-up menu shown below, so move the SEC variable into the box marked Numeric Variable -> Output Variable. If you know the commands and how to input them correctly then syntax can be very efficient, allowing you to repeat analyses with minor changes very quickly. I will call this new variable ha_rescue. Once a variable is entered here, you can click on “Type & Label” to assign a variable type and give it a label. Luckily it is quite similar to English and so is relatively easy to learn – the main difference is the use of grammar and punctuation! Variables can be combined in SPSS by adding or multiplying them together. If you want to do so for only some cases but not others, use IF instead. This might sound silly at first – surely SPSS can assign a value as missing when a value is well... not there? (Stated another way, a given case could have at most one missing test score and still be OK.). If you do not see the new variable, the computation was unsuccessful. Researchers often want to combine two or more variables in order to create a new variable. SPSS users often want to know how they can combine variables together. There are many kinds of calculations you can specify by selecting a variable (or multiple variables) from the left column, moving them to the center text field, and using the blue buttons to specify values (e.g., “1”) and operations (e.g., +, *, /). In the previous example, we used the built-in MEAN() function to compute the average of the four placement test scores. It allows you to align values to the left, right or centre of their cell. Notice that in rows 6 and 11, nonmissing values are all equal to No, so the resulting value of any_yes is 0. This inevitably results in variable names that make no sense to anyone but the researcher! The height (in inches) and weight (in pounds) of the respondents were observed; so to compute BMI, we want to plug those values into the formula, $$ \mathrm{BMI} = \frac{\mathrm{Weight}*703}{\mathrm{Height}^{2}} $$. Once you have set up your new variable and are happy with it you can use it in your analysis! In this example, we wish to compute BMI for the respondents in our sample. See Page 1.6 if you can’t remember how to do this. You then need to name (and Label, as you would in the Variable View) the Output Variable, which we have named SECshort (given we are essentially shortening the original SEC variable). For example, you may want to round values to one decimal place (Extension A) or apply a transformation which turns a raw exam score into a percentage. Is it possible, if more than one choice is indicated , for the recode to use a priority system in choosing which one to specify in the new variable? The Target Variable field is where you will type the new variable name such as newvar in the example above. you may only want values with two significant figures – a range of -99 to 99). This menu allows you to assign a value to each category (level) of your variable. Syntax is ‘run’, as you would run computer code. If you are analysing your data using multiple regression and any of your independent variables were measured on a nominal or ordinal scale, you need to know how to create dummy variables and interpret their results. If there is no 1, the variable should contain 2. It's also possible to use COMPUTE syntax to compute or transform string variables (i.e., variables containing characters other than numbers). If any of 6 words are in any of these columns, then I would want "yes" in my new variable "ha_rescue". The Compute Variable window will open where you will specify how to calculate your new variable. This requires estimating an intercept (often called a constant) and a slope for each independent variable that describes the change in the dependent variable for a one-unit increase in the independent variable. You do not need to worry about it but learning it in tandem with learning SPSS will really help your understanding so don’t ignore it! the number of categories – 1) and include these new dummy variables in your regression model 3 Again, this is not something to worry about yet... but it is an important issue that will require familiarity with the recoding process. As you can see there were 11090 cases where both the pupil and the parent had aspirations for full-time education after age 16. SPSS is not case-sensitive with respect to variable names. 3 Click on Old and New Values. If you would like to know more about the Office of National Statistics SEC coding system see our Resources page. Actually there are lots of different types of missing value to consider and sometimes you will want to include missing cases within your analysis (Extension B talks about missing data in more detail). including nominal and ordinal variables in linear regression analysis When working with string variables -- and especially when working with text data that's been manually typed into the computer -- your data values may have variation in capitalization. My goal is to create a new variable in an existing dataset. If a case does not meet that condition, it will be assigned a missing value for the new variable. An easy way to get hold of syntax is to copy it from the Output Window. After activating it, cases with 1. zeroes, 2. user missing valuesor 3. system missing values on the filter variable are excluded from all analyses until you deactivate the filter. SPSS String Function. The first step in creating an SPSS variable can be accomplished in several ways: Click on the Variable View tab at the lower left of the SPSS window: Or, double click on the gray column header above any column: Or, click on View | Variables: Or, press Ctrl-T. Alternatively, you can produce the same result by opening a syntax window (File > New > Syntax) and executing the following code: This syntax can be generated automatically by following the dialog window steps above and clicking Paste instead of OK. Let's instead try computing the average test score using the built-in mean function. These questions may originally be coded as 0 (absent) and 1 (present); or 0 (no) and 1 (yes). However, note that dummy variables are often a key part of regression so learning how to set them up is very important. A multiple-response set acts like a variable in some ways, but in other ways it doesn’t. the number 1 in a new variable. Notice that in the Compute Variable window, the box where the formulas are entered is now labeled "String Expression" instead of "Numeric Expression". Learn how to create a new, grouping variable in SPSS using the "Transform" - "Compute Variable" command in SPSS. This worked well to create a variable with a combo of age group and sex: *create age group matched with gender categories egen agesex=group(agegrp gender), label tab agesex A common string transformation is to convert a string to all uppercase or all lowercase characters. There are 10 settings: Name: This is the name which SPSS identifies the variable by. It seems the process of computing our new variable has been successful... yay! so that you can analyse them statistically. Below we see summary statistics for length. This tutorial shows how to compute new variables in SPSS using formulas and built-in functions. I want for each case of 1, each case of 2 etc. Width: Another option we don’t really use. You do not necessarily need to use the Compute Variables dialog window in order to compute variables or generate syntax. You can edit this at any time. Attempting to teach you how to write syntax would probably be a fruitless exercise. These boxes contain the syntax that you will need to paste into the Syntax Editorin order to run the related process. I have a data base of patients which contain multiple variables as yes=1, no=0. We wanted to give you a basic grounding as it will come in handy later but realise we have only scratched the surface. It needs to be short and can’t contain any spaces or special characters. With time and perseverance you will learn these commands yourself. This is useful when you want to create a total awareness variable or when you want two or more categorical variables to be treated as one variable in your tables.