Scenario 10

Directions

Open the ehs02 program from the EHS folder and correct the errors in the program below.
Example Code 17.2 ehs02 Program: Fix the Errors
work.mycars;
   set sashelp.cars;
   AvgMPG=mean(mpg_city, mpg_highway);
run;
title 'Cars With Average MPG Over 40';
proc print data=work.mycars
   var make model type avgmpg;
   where AvgMPG>40;
run;
title 'Average MPG by Car Type';
proc means data=work.mycars avg min max maxdec=1;
   var avgmpg;
   class type;
run;
title;

Test Your Code

  1. What is the number of observations where the variable Type is Sedan?
  2. How many observations are printed to the report titled, “Cars With Average MPG Over 40”?

Objectives Accomplished

  • Identify the characteristics of SAS statements.
  • Define SAS syntax rules and identify common syntax errors such as misspelled keywords, unmatched quotation marks, missing semicolons, and invalid options.
  • Use the log to help diagnose syntax errors in a given program.
Last updated: February 14, 2019
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset