SAS Base Certification – Question 9

Question 9: Given the following SAS error log

  44   data WORK.OUTPUT;
  45     set SASHELP.CLASS;
  46     BMI=(Weight*703)/Height**2;
  47     where bmi ge 20;
  ERROR: Variable bmi is not on file SASHELP.CLASS.
  48   run;

What change to the program will correct the error?


A.	Replace the WHERE statement with an IF statement 
B.	Change the ** in the BMI formula to a single * 
C.	Change bmi to BMI in the WHERE statement 
D.	Add a (Keep=BMI) option to the SET statement 

*The SAS certification sample problem and answer are sourced from the official SAS sample questions page. All answer logs, data sets, output, and commentary are provided by this blog.

Correct Answer

Incorrect Answer

Click to see Answer Explanation below

thanks for your support


    Yangshengzi Ma Oct 28, 2015

    SAS does not implicitly treats ** as a single * , ** means power calculation. So the BMI formula is right in this code.

    veera Nov 15, 2015

    Yes sas will treat ** as power calculation,not as as a single *

    Divya Feb 25, 2016

    Why this explanation log has different code?
    “181 if weight ge 20;”
    it should be bmi right?

      atisha Feb 29, 2016

      no… bmi is a variable which has to be created. it is not present in the dataset already . so it cannot be used with the where statement πŸ™‚

        Linda Aug 23, 2016

        You CANT use WHERE on ANY Created. Var. learned this directly from SAS Cert review 4 day class. It MUST be an IF

    shovland Dec 31, 2016

    How do we know this variable is not in the original data set?

    Olubunmi Eko Sep 08, 2017

    I disagree with the answer for these reasons.
    1. “The WHERE statement work fine on pre-existing variables” …BMI is a pre-existing variable that is what makes option ‘C’ my answer.
    2.In the sample code shown, an entirely pre-existing variable ‘Weight’ was introduced on line 181.


Leave a Comment

Please keep in mind that comments are moderated and rel="nofollow" is in use. So, please do not use a spammy keyword or a domain as your name, or it will be deleted. Let us have a personal and meaningful conversation instead.