You are on page 1of 1

Programming II ARRAY Bonus

The country.dat file has several variables that have hard coded values which indicate missing
data (i.e., 9999999, 9999999.9, 999999.9). The purpose of this exercise is to use an array to
dynamically reference multiple variables at one time to search for missing data in a variety of
formats.

1. Download the files from the D2L contents tab and put files to the c:\temp directory (if you
don't have a directory/folder on C:\, create one)

3. Open the country.sas program. Change the INFILE statement to read


c:\temp\COUNTRY.DAT. Now define the data set COUNTRY as a permanent data set.

4. Create a new variable called PCGNP2 by dividing the GNP by the POPULATE.

5. Add the following labels to the corresponding variables.

NAME - "COUNTRY'S NAME"

CONTIN - 'CONTINENTAL'

DODEV - 'DEGREE OF DEVELOPMENT'

GNP - 'GNP IN MILLIONS OF DOLLARS'

MILEXP - 'MILITARY EXPENDITURE IN MILLIONS OF $'

EDUCEXP - 'PUB. EDUCATION EXPENDITURE IN MIL.$';

6. Create an array named MSG which associates with the following variables: population, area,
gnp, milexp, educexp

7. Assign 9999999, 9999999.9, 999999.9 and 99999.9 as missing values for these five variables
using the array. Hint: Check out information on the DO OVER loop available in the data step.

8. Create a table of descriptive statistics including mean, median and standard deviation for
Military expenditure, Population and GNP. Reminder: Be sure to take care of the missing values
before any statistical analysis.

9. Upload the final SAS program and the output to the Dropbox.

You might also like