
SAS Programming Workshop I - Exercise
Creation date: 10/20/1999
Author: Karl Ho
1. Download the files from the download page and put files to the c:\temp directory (if you don't have a directory/folder on C:\, create one)
2. Read in the SAS program class.sas in c:\temp. Try to use the INCLUDE command. Bear in mind you need to type the full path. Fill in the path for the data file in place of the filename at the INFILE statement. Run the program. Use the viewtable command to browse the data. Can you run some analysis using this data set? (Hint: Solutions-->Analysis-->Guided Data Analysis)
3. Include the country.sas program. Create a library called SASWS1 referenced under c:\temp' (create a subdirectory if you dont have one) and a file call DATAIN referenced to the file c:\temp\COUNTRY.DAT. Now define the data set COUNTRY as a permanent data set under CLASS.
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.
SAS/Analyst
8. Import country.xls into SAS/Analyst. Create the PCGNP3 using the above formula. Perform the following analyses:
Reminder: Be sure to take care of the missing values before any statistical analysis.
Answer.sas for Questions 3-7.
Last updated: 01/18/06 by Karl Ho.