Help with Weight example from SAS Website

Accepted Solution Solved
Reply
Contributor
Posts: 50
Accepted Solution

Help with Weight example from SAS Website

I'm going through an example from the website and am not sure where one set of #'s are coming from... Please see the link and the highlighted section from the link below:

SAS/STAT(R) 9.22 User's Guide

Here is the section from which I can't determine where the #'s are coming from:

data IceCream;

  set IceCream;

  if Grade=7 then Prob=20/1824;

  if Grade=8 then Prob=9/1025;

  if Grade=9 then Prob=11/1151;

  Weight=1/Prob;

run;

Any help is greatly appreciated!


Accepted Solutions
Solution
‎01-15-2014 11:09 AM
Super User
Posts: 17,784

Re: Help with Weight example from SAS Website

The Ice Cream dataset only has 40 observations.  The 20 is the number of students in Grade 7, 9 in Grade 8, 11 in Grade 9.

The 1824 are the population not the sample size.

See the previous example for the dataset.

data IceCream;

   input Grade Spending @@;

   if (Spending < 10) then Group='less';

   else Group='more';

   datalines;

7 7  7  7  8 12  9 10  7  1  7 10  7  3  8 20  8 19  7 2

7 2  9 15  8 16  7  6  7  6  7  6  9 15  8 17  8 14  9 8

9 8  9  7  7  3  7 12  7  4  9 14  8 18  9  9  7  2  7 1

7 4  7 11  9  8  8 10  8 13  7  2  9  6  9 11  7  2  7 9

;

proc freq data=icecream;

table grade;

run;

View solution in original post


All Replies
Solution
‎01-15-2014 11:09 AM
Super User
Posts: 17,784

Re: Help with Weight example from SAS Website

The Ice Cream dataset only has 40 observations.  The 20 is the number of students in Grade 7, 9 in Grade 8, 11 in Grade 9.

The 1824 are the population not the sample size.

See the previous example for the dataset.

data IceCream;

   input Grade Spending @@;

   if (Spending < 10) then Group='less';

   else Group='more';

   datalines;

7 7  7  7  8 12  9 10  7  1  7 10  7  3  8 20  8 19  7 2

7 2  9 15  8 16  7  6  7  6  7  6  9 15  8 17  8 14  9 8

9 8  9  7  7  3  7 12  7  4  9 14  8 18  9  9  7  2  7 1

7 4  7 11  9  8  8 10  8 13  7  2  9  6  9 11  7  2  7 9

;

proc freq data=icecream;

table grade;

run;

Contributor
Posts: 50

Re: Help with Weight example from SAS Website

yep that makes sense, thanks for the quick response!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 148 views
  • 0 likes
  • 2 in conversation