Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: duplicating observations


From   "Newson, Roger B" <r.newson@imperial.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: duplicating observations
Date   Wed, 26 Apr 2006 18:49:52 +0100

You might like to try the -expgen- command, which is an extended version
of -expand- downloadable from SSC, which sorts the dataset so that the
duplicates  of each observation are side by side, and can optionally add
a new variable giving the sequence number of each duplicate within the
set of duplicates for the same observation. In Stata, use the -ssc-
command to download -expgen-.

I hope this helps.

Roger


Roger Newson
Lecturer in Medical Statistics
POSTAL ADDRESS:
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute at Imperial College London
St Mary's Campus
Norfolk Place
London W2 1PG
STREET ADDRESS:
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute at Imperial College London
47 Praed Street
Paddington
London W1 1NR
TELEPHONE: (+44) 020 7594 0939
FAX: (+44) 020 7594 0942
EMAIL: r.newson@imperial.ac.uk
WEBSITE: http://www.imperial.ac.uk/nhli/r.newson/
Opinions expressed are those of the author, not of the institution.


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of SamL
Sent: 26 April 2006 15:43
To: statalist@hsphsun2.harvard.edu
Cc: SamL@demog.berkeley.edu
Subject: Re: st: duplicating observations

As some have said, you can use the -expand- command.  If you only need
to
expand so you can estimate models, many models allow frequency weights,
which basically do the expansion on-the-fly during estimation.

Hope this helps.
Sam

On Wed, 26 Apr 2006, louis boakye-yiadom wrote:

> Dear All,
> Is there a Stata command for duplicating observations? I have a
summarised
> dataset, in the sense that it is in a "frequency table" format, but
I'm
> interested in converting it into individual level observations. So I
reckon
> if there is a way of asking Stata to generate multiple copies of an
> observation, I would be able to have the data in the desired format.
Any
> help will be appreciated. Thanks.
>
> Louis
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index