Search the site...

SASCRUNCH TRAINING
  • Home
  • Member's Area
  • How to Start
  • SAS Interface
  • Creating a Data Set
  • Practical SAS Training Course
  • SAS Certified Specialist Training Program
  • Proc SQL Course
  • Introduction to Time Series Analysis
  • SAS Project Training Course
  • Full Training / Membership
  • Sign up
  • About us
  • Contact us
  • Home
  • Member's Area
  • How to Start
  • SAS Interface
  • Creating a Data Set
  • Practical SAS Training Course
  • SAS Certified Specialist Training Program
  • Proc SQL Course
  • Introduction to Time Series Analysis
  • SAS Project Training Course
  • Full Training / Membership
  • Sign up
  • About us
  • Contact us
Sentry Page Protection
Please Wait...
**** Question 1 ****;

data groups;
set input48;
if upcase(cvar) in ('A', 'B', 'C', 'D', 'E', 'F', 'G') then group=1;
else if upcase(cvar) in ('H', 'I', 'J', 'K', 'L', 'M', 'N') then group=2;
else group=3;
new_y = input(y, 7.3); *convert to numeric;
run;

/* Calculate the average of X and Y by Group */
/* What is the average of X and Y for Group 2? */

proc means data=groups mean maxdec=2;
class group;
var x new_y;
where group=2;
run;

What is the average of X for Group=2? 
Answer: 47 (or 48)

What is the average of Y for Group=2?
Answer 703


**** Question 2 ****;
data class (keep=name sex height group);
set sashelp.class;
length group $ 30;
if sex = "M" and height > 64 then Group="Above Average";
else if sex = "F" and height > 60 then Group="Above Average";
else Group="Below Average";
run;

proc freq data=class;
table group;
run;

There are 10 students whose height is above average and 9 students whose height is below average.
Next
Already a member? Go to member's area.