Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Inserting non blank observations multiple times
From
Eric Booth <[email protected]>
To
"<[email protected]>" <[email protected]>
Subject
Re: st: Inserting non blank observations multiple times
Date
Fri, 8 Jul 2011 19:07:41 +0000
<>
Here's one approach:
****************
clear
**create fake data:
input str10(v1)
original1
original2
original3
end
**
levelsof v1, loc(o)
foreach v in `o' {
g `v' = "`v'"
}
keep in 1
set obs 762
forval n = 2/`=_N' {
foreach v of varlist original* {
replace `v' = "new`=`n'-1'" in `n'
}
}
drop v1
stack original*, into(all) clear
****************
- Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
On Jul 8, 2011, at 1:48 PM, Bryan Stuart wrote:
> I have a data set with 94 observations. After each observation, I want
> to enter 761 (non blank) observations. The new observations will be
> the same for each of the original 94 observations. I found the INSOB
> module, which can easily enter blank observations. This isn't what I
> want. I want to move from something like:
>
> original1
> original2
> original3
>
> to something like:
>
> original1
> new1
> new2
> ...
> new761
> original2
> new1
> new2
> ...
> new761
> original3
> ...
>
> Does anyone have suggestions? Thanks in advance.
>
> Bryan Stuart
> *
> * 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/