Statalist


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

st: RE: How do I create a new dataset with just one variable but 500,000 obs?


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: How do I create a new dataset with just one variable but 500,000 obs?
Date   Thu, 28 Aug 2008 17:31:28 +0100

Look for help on -in- and -egen, seq()-. 

Nick 
n.j.cox@durham.ac.uk 

Hagen von Hermanni

Or to put it another way:
How can I tag specific observations (letīs say obs 1 to 100,000) and define their outcomes in variable x?

I need to create a reference dataset for weighting. I stratified my dataset into 16 cells. The reference dataset describes the city of Leipzig for sex, age and (un)employment. I stratified these informations likewise and hoped to finally crate a dataset with 504.000 observations and one variable, containing 16 categories. So I could calculate the needed weights to adjust my original sample to the population of Leipzig.

BUT, how to I define which observation belongs to which cell?

I started this way:

set obs 504000
generate cell = 0

Well, and now? I thought about the replace command

replace cell = 1 [ and here should be said which obs belong there!]


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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