To Lecture Notes

CSC 433 -- Mar 28, 2016

General Comments about CSC 433

 

Review Questions

  1. Discuss the similarities and differences between SAS data and proc steps.
     
  2. Find the mistakes in this SAS code:
  3. Using the input file kids.txt, write a SAS program that does the following:
     
    1. finds the total number of kids,
       
    2. finds the minimum and maximum ages of the kids,
       
    3. finds the minimum and maximum ages as well as the total number of the girls and boys separately,
       
    4. finds the first girl and boy names in alphabetical order.

  4. For what are SAS labels used?

 

Obtaining Details about a Dataset

 

Getting Started with SAS

 

More SAS Questions

  1. Create a SAS dataset without using an input statement. How can you create more than one observation in this way?
    Ans: To create a dataset with one observation:
    To create a dataset with more than one observation:
    The default behavior is to send the data the data step to the dataset automatically each time the end of the data step is reached. If you want to send an observation to the dataset in the middle of the the data step, use the output statement. However, if you use any output statements in a data step, you must use them every time you want to send an observation to the dataset, even at the end of the data step.
     
  2. Here are three data files, quiz1.txt, quiz2.txt, and quiz3.txt each containing 8 quizzes, a midterm and a final exam for each student. In quiz1.txt, one input line is used to generate one observation.  In quiz2.txt, each line is used to generate three observations. Finally, in quiz3.txt, three input lines are used to form each observation.  Use the specifications in these tables to compute the course score and final grade for each of the input files.
     
    Score Proportion of
    Course Score
    Quiz Average 40%
    Midterm 30%
    Final 30%
     
    Course Score Course Grade
    90 - 100 A
    80 - 90 B
    70 - 80 C
    60 - 70 D
    0 - 60 F

    Use @@ at the end of an input line to hold the line until all the data on that line is read.
     
    Use @ at the end of an input line to hold the line until the end of the data step.
     
    The SAS symbol for missing value is a period ( . ).
     
    Answers: See the Quiz Examples (Quiz1, Quiz2, and Quiz3).

 

Specifying the Read Position in an Input File

 

SAS Informats

 

SAS Formats

 

Writing to a File

 

Project 1