Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: How to regenerate data

From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: How to regenerate data
Date   Sat, 29 Jan 2005 10:31:43 -0500

At 03:30 PM 1/29/2005 +0900, P.Chakkrit wrote:
Hi all,

I try to do some basic stata programming but still quite lost and would
appreciate any guidance. I have a dataset like N1 N2 N3 X1 X2 X3 for each
period of time T. N is the number who answer each choice and  X are
macroeconomics data. What I try to do is generate new observation according
to each N (e.g. if N1=100 generate new 100 observation) that have the same X
value for each period of time T. I have looked at foreach, forval, if
command and the archive for previous questions but still could not move on
and would appreciate any guidance.

Like Kit says, you may be able to get by using frequency weights. Alternatively, something like

expand N1

would duplicate observations for you. It sounds like what you really most want is to reshape the data though? So that each observation would be something like T N X? i.e. you would have 3 observations for each current observation? See the -reshape- command.

Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal):
WWW (department):

* For searches and help try:

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