.-
Help for ^sampstat^                                                   Bill Rising
.-

Getting sampling statistics from a dataset
------------------------------------------

    ^sampstat^ varlist [^if^ exp] [^in^ range]^, me^an ^std^dev ^size(^#^)^ [^samp^les^(^#^)^]
        [^seed(^#^)^] [^saving(^filename^)^] [^replace^]


Description
-----------

^sampstat^ is made to pull samples without replacement from a dataset, and post
summary statistics to another dataset which can be saved automatically. Right
now, the only statistics which can be posted are the sample mean and sample
standard deviation. This program should be contrasted with @bstrap@, which
samples with replacement.

Options
-------

^mean^ should be specified if the sample means are wanted. The variables
containing the sample means will have the letter m prepended to the old
variable names. No error checking is done for duplicate variable names!

^stddev^ should be specified if the sample standard deviations are wanted. Note
that at least one of ^mean^ and ^stddev^ needs to be specified. Both may be
specified if so desired. The variables containing the sample standard
deviations will have the letter s prepended to the old variable names. No error
checking is done for duplicate variable names!

^size^ gives the number of observations to be pulled as a sample. This must be
greater than 0 and less than the number of observations left after application
of the (optional) ^if^ and ^in^ clauses.

^samples^ is the number of samples to pull. This defaults to 100.

^seed^ allows the user to set the seed for the random number generator.

^saving^ allows the new dataset to be saved as the filename after all the
samples have been pulled. Stata will complain if the file already exists,
unless

^replace^ is specified, since replace allows the saving file to be overwritten.

Examples
--------

    ^sampstat bling aid, mean stddev size(20) samples(100)^
    will make a new data set consisting of the sample means and standard
    deviations of the variables ^bling^ and ^aid^ (both existing in the present
    dataset) coming from 100 random samples of size 20 from the present
    dataset. The new dataset will have variables named ^mbling sbling maid^ and
    ^said^.

    ^sampstat aid if aid<100, mean stddev size(40) saving(sampaid) replace^
    will make a new dataset, name it ^sampaid^, and save it, overwriting any
    already existing ^sampaid^ file. The new dataset will contain the variables
    ^maid^ and ^said^, which will contain sample means and standard deviations from
    the original dataset for samples of size 40 coming from those observations
    where ^aid^ is less than 100.


Notes
----- 

This is a rough implementation which undoubtedly can be easily tricked.


References
----------

See @bstrap@ for bootstrapping, and @postfile@ for information about making such postfiles.

Author
------

Bill Rising
Department of Biostatistics
Johns Hopkins University
brising@@jhsph.edu
(410) 955-2468
