SAS FAQ 
How do I analyze survey data with a simple random sample design?

This example is taken from Levy and Lemeshow's Sampling of Populations.
page 53 simple random sampling

NOTE:  The n on the proc surveymeans statement indicates that there are 773 primary sampling units (PSUs).  Because this is simple random sampling, the elements and the PSUs are the same thing.  Hence, 773 is the population total from which the sample was drawn.
This example uses the momsag data set.

proc surveymeans data = momsag n = 773 mean sum std;
  weight weight1;
  var momsag;
run;
The SURVEYMEANS Procedure-

            Data Summary

Number of Observations            25
Sum of Weights            773.000002

                               Statistics

                               Std Error
Variable            Mean         of Mean             Sum         Std Dev
------------------------------------------------------------------------
MOMSAG          0.920000        0.054475      711.160002       42.108894
------------------------------------------------------------------------

This example is taken from Lehtonen and Pahkinen's Practical Methods for Design and Analysis of Complex Surveys.

page 29 Table 2.4  Estimates from a simple random sample drawn without replacement (n = 8); the Province'91 population.

data page29;
  input id cluster ue91 lab91;
  fpc = 32;
  wt = 4;
  strata = 1;
  cards;
  1 1 4123 33786
  2 4 760 5919
  3 5 721 4930
  4 15 142 675
  5 18 187 1448
  6 26 331 2543
  7 30 127 1084
  8 31 219 1330
  ;
run;

The code below gets the total and the standard error of the total for the variable ue91 and lab91 as shown in the first line of the table.  You can calculate the ratio by hand using the information in the output.  We know of no way to get the median from proc surveymeans

proc surveymeans data = page29 mean sum std cv r = .25;
  var ue91 lab91;
  weight wt;
  strata strata;
  cluster cluster;
run;
The SURVEYMEANS Procedure

            Data Summary

Number of Strata                   1
Number of Clusters                 8
Number of Observations             8
Sum of Weights                    32

                                       Statistics

                               Std Error        Coeff of
Variable            Mean         of Mean       Variation             Sum         Std Dev
----------------------------------------------------------------------------------------
ue91          826.250000      415.070586        0.502355           26440           13282
lab91        6464.375000     3430.088578        0.530614          206860          109763
----------------------------------------------------------------------------------------

How to cite this page

Report an error on this page or leave a comment

The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.