Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: How can I creat a new dataset with just one variable (80 obs.) from scratch ?


From   Anna Reimondos <areimondos@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: How can I creat a new dataset with just one variable (80 obs.) from scratch ?
Date   Wed, 18 Nov 2009 12:07:33 +1100

Hello,
I would like to create a completely new dataset from scratch with just
one variable. I would like the variable (age) to have 80 observations,
increasing sequentially.

Example:

age
1
2
3
4
..
80


I have tried a few different things, eg

clear
gen age=_n

or ...

clear
gen age=1
replace age=_n
keep if age<=80


but nothing happens....

Does anyone know how to do this. I have tried searching for
information but it is one of those things which is hard to search for.
Obviously I open the data editor and input the values by manually but
I would prefer to have something reproducible.

Thanks!
Anna
*
*   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