Exercises
Task 1
Open the dataset “lifeexp” and make yourself familiar with the data.
Task 2
Generate a variable which indicates whether the population growth was zero or positive. Label the variable. Define an appropriate value label and attach it to the new variable.
Task 3
Generate a variable for the natural logarithm of GNP p.c. What should you do if you are interested in obtaining the precise value of the natural logarithm? Label the variable. Format the variable such that 4 digits after the decimal point are displayed.
Task 4
Create a variable with the sum of GNP p.c. per region. Label the variable.
Task 5
Generate a variable which classifies observations into those below a GNP p.c. of 5,000, those with a GNP p.c.>=5,000 but below 10,000, and those with a GNP p.c. >= 10,000 (but not missing). Make sure that the variable has appropriate value labels. Label the variable.
Task 6
Generate a variable classifying each existing combination of the region variable and the variable generated in Task 5. Make sure that the variable has appropriate value labels. Label the variable. Generate indicator (binary/dummy) variables for each combination of the region variable and the variable generated in Task 5.
Task 7
Create an ID variable for each country. Label the variable. What is the difference between the ID variable and the country variable? Why might this matter?
Task 8
Find two ways to generate a variable which contains the lowest GDP p.c. of the dataset. Would both ways work if you would generate a variable which contains the highest GDP p.c.?