rssunt.gif (12308 bytes)


Introduction to SAS - Exercise

Data | Procedures | Examples | Download | Exercise | Manuals | Evaluation

Creation date: 7/17/98
Author: Karl Ho

1.  Right click the links to download the exercise.sas and exercise.dat files. Save the files in c:\temp directory. Read in the program titled "exercise.sas" in SAS (Hint: File-Open in Program Editor or use the command INCLUDE 'path:exercise.sas' in the command box). Run the program under SAS for Windows. Make sure you point to the right data file. (Hint: the data file for this program is called "exercise.dat" which resides in the directory)

2. What is wrong with the program?

3. Compare the temperatures of the different cities.  Before you do that, create a variable that is of the same scale.  Use the following formulae from NASA to do the conversion:

To convert Fahrenheit to Celsius:
Tc=(5/9)*(Tf-32)
Tc=temperature in degrees Celsius Tf=temperature in degrees Fahrenheit
* means multiply

Now, to convert from Celsius to Fahrenheit, :
Tf=(9/5)*Tc+32
Tc=temperature in degrees Celsius Tf=temperature in degrees Fahrenheit

Sample codes to convert Fahrenheit to Celsius:

if temptype="F" then tempc=(temp-32)/9*5;
         else if temptype="C" then tempc=temp; 

Can you convert Celsius to Fahrenheit?

4. Create a library called EXERCISE for the data set on the same directory and put the file under that library. (HINT: you need to place a statement like this: libname exercise ‘c:\temp’)

5 (optional). Explore the SAS/INSIGHT and SAS/LAB modules using the menu. Create a Line Plot of the rainfall distribution. (Hint: Global --> Analyze --> Interactive data analysis/Guided data Analysis)

answer1.sas 


MAIN

Last updated: 01/18/06 by Karl Ho.