Here we use if else statements to compute the age and Grades based on the dataset given in the program. Using this information, compute a course grade (Course) as a weighted average of the Quiz (20%), Midterm (30%) and Final (50%). This increases efficiency because SAS skips testing all the ELSE conditions when a previous IF condition is true.Ĭhapter 7: Problem 1: Using IF and ELSE IF statements, compute two new variables as follows: Grade (numeric), with a value of 6 if Age is 12 and a value of 8 if Age is 13. The quiz grades have numerical equivalents as follows: A = 95, B = 85, C = 75, D = 70, and F = 65. If you are working with very large data sets and want to squeeze every last drop out of the efficiency tank, you should place the IF statements in order, from the ones most likely to have a true condition to the ones least likely to have a true condition. Two of the basic tools for conditional processing are the IF and ELSE IF statements. All datasets used are supplied by Ron Cody and attached at the end of the blog in a drop box file for easy access. I have used Learning SAS by Example – A programmers guide by Ron Cody. The experience was somewhat unnerving initially but as time passed and I started working more and more on it started feeling quite comfortable.īelow are a list of few programs that I have run in SAS along with the codes and solutions and a little bit of description. I recently started working on SAS university edition.