To Lecture Notes

CSC 433 -- Apr 17, 2017

Review Exercises

  1. How do you do the following with a put statement when writing to a file created by a file statement?
     
    1. Go to column 15.   Ans: @15
       
    2. Go to a new line.   Ans: /
       
    3. Print a time variable. Ans: Use one of the time formats, such as TIME. Usually you get better results when you include a field width like TIME9. or TIME10.
       
    4. Hold a line for the next put statement.   Ans: You can use either @ or @@

  2. Which of these statements are executable? Which are declarative?
    Ans:
    Executable Declarative
    input datalines
    put drop
    set file
      infile
      keep
      length
      retain

  3. Find the errors in this SAS source code file.  The corrected version is also shown.  It uses the kids.txt file as its input file.
     
  4. How can you determine the gender from the Erie Marathon file for Project 3?
    Ans: Suppose you have extracted a field named age_gender, which is a character variable which contains an age like 34 or an age with an asterisk 28*. Here are two possibilities:
  5. Suppose that the sashelp.class permanent data is trashed on your SAS installation. How can you restore it from the copy on a different computer? Ans:
  6. Using the sashelp.class dataset, plot weight vs. height, using the plotting symbols blue for male and red for female. Here is the SAS graphics symbol chart.
  7. Create the scatterplot in Exercise 11 using sgplot. Note:
    The male and female symbols are not available with ODS graphics.
    Ans: Here is a solution using the default o and + symbols:
    To choose your own plotting symbols, create an ODS graphics style template as in the Iris2 Example.
     
  8. Here are results of an early Cholera study (1894-96):
     
    Inoculated Infected Count
            0        0    473
            1        0    276
            0        1      66
            1        1       3

    Summarize this data using (a) proc freq, (b) proc gchart, (c) proc sgplot. Ans:

 

Quiz 3

 

SGPLOT Scatterplots

 

More ODS Graphs

 

A Double Axis Graph

 

Information about SAS procs

Statements and Options Used in Many Plots

proc sort

proc print

proc means and proc summary

proc sql

 

Project 4