<>
" Obviously I open the data editor and input the values by manually"
In the absence of evidence to the contrary, we have to assume that you are a
Stata 11 user, so if you did enter some values into the Data Editor, the
commands executed would be echoed to Stata`s Results window, and this would
give you a hint as to the -set obs- that Eric pointed out to you. Output for
inputting the numbers 1 to 6 is:
***
set obs 1
generate var1 = 1 in 1
set obs 2
replace var1 = 2 in 2
set obs 3
replace var1 = 3 in 3
set obs 4
replace var1 = 4 in 4
set obs 5
replace var1 = 5 in 5
set obs 6
replace var1 = 6 in 6
***
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Anna Reimondos
Sent: Mittwoch, 18. November 2009 02:08
To: [email protected]
Subject: st: How can I creat a new dataset with just one variable (80 obs.)
from scratch ?
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/
*
* 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/