Saturday 19 September 2015

SAS by Ron Cody - Practice problems with solution



OUTPUT


In this program we have used where statement to print the observations from data set based on some conditions.


OUTPUT



Here we have Used retain statement and sum to find the sale to date that is cumulative sales.


    OUTPUT

Using do statement to run an iterative loop and find the log for each value.





OUTPUT


Using do until to find the number of years for the amount to reach atleast 30,000.


OUTPUT

using yrdif function to find age from dates. 



OUTPUT


intck function is used to find the number of months between two dates. it can be used to find number of years,weekdays as well as quarters between two specific dates.



OUTPUT







OUTPUT

Using in function with merge and getting output based on conditions.


OUTPUT


The use of n and nmiss function to find number of non missing and missing values.



OUTPUT


Use of arrays to replace 999 with missing value.

1 comment:

  1. You have a lot to improve on the blog.  First, you think of this exercise as making your class notes and homework copy, combined. Also, you need to separate blog for SAS from blog for Python.

    Your blog would look much better, if you:

    1. Make separate page for chapters and have an index page, linking the pages for the chapters.  Add links at each chapter to go back to index, previous (if any) and next (if any) pages.
    2. Introduce the chapter (i.e. the page) in your own words.
    3. For each problem, explain the problem you are attempting to solve. Cut and paste from Cody's book should be OK.
    4. Make all the screenshots of programs and output readable and of similar size.
    5. For each problem solved, write what you learned by solving the problem.  Even one line is fine for this. 
    6. Write a conclusion or summary for each page.

    I understand, it is lot of work now, given you are trying to do it at eleventh hour.  For the next submission, if time permits, you can give it a try.

    ReplyDelete