PROBLEM 2

EDITING A RAW DATA SET

USING PROC SORT

The student should read the section on PROC SORT in the SAS User's Guide and SAS Introductory Guide, and compare his/her output with the output presented there.

Go to any computer terminal, logon and get into the READY mode. From READY type in ISPF 2 to access the ISPF EDIT-ENTRY PANEL. Recall the dataset SAS.DATA. You can then edit the program contained in it (in this case the height-weight program). Refer to the BASICS section under "Editing Datasets Using ISPF" for detailed instructions on the following tasks.

Delete the following lines from the dataset you created in PROBLEM 1:

PROC PRINT;

PROC PLOT;

PLOT HEIGHT*WEIGHT=SEX;

//

The last line in your dataset should now be the data line for "WILLIAM". Insert the following lines in place of the lines you deleted. (See BASICS on how to insert lines in ISPF)

PROC SORT;

BY SEX AGE HEIGHT;

PROC PRINT;

PROC PRINT; ** This is not an error in duplication.**

BY SEX AGE;

//

Return to the COMMAND INPUT line by pressing either (ALT and PF12) or PF24. Type SAVE to save the edited dataset. Type SUBMIT to send a copy of your new dataset to the input queue. Then type =X to get back to READY mode. Type SPACELST. Finally, type NDLOGOFF. Later in the day return to the Computing Center and pick up the output.

WRITING UP YOUR PROGRAM

Be sure to write up your output carefully. Explain the new commands and output you have generated in detail by writing in pen all over your output. This is standard procedure for all of the outputs you hand in.

-Explain what PROC SORT does and why it is used

-How did the PROC SORT handle each of the variables listed?

-What is different about the PROC PRINTs in this problem and the PROC PRINT in PROBLEM 1?

-You may add extra commands and PROCs to your computer job and explain them for extra credit. (Be wild, daring and creative - this is the best way to learn SAS and about computers generally.)