Statalist


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

st: Placing a non-missing value at beginning of a block


From   Thomas Speidel <thomas@tmbx.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Placing a non-missing value at beginning of a block
Date   Wed, 10 Dec 2008 10:20:44 -0700

I am trying to create a spreadsheet ready table from within Stata and need to do some data management in order to go from this:

n	pvalue
1	.
2	.
3	.
4	.
5	0.151
6	.
7	.
8	.
9	.
10	0.000
11	.
12	.
13	.
14	.
15	0.146
16	.
17	.
18	.
19	.
20	.
21	0.001
...

To this:

n	pvalue
1	0.151
2	.
3	.
4	.
5	.
6	0.000
7	.
8	.
9	.
10	.
11	0.146
12	.
13	.
14	.
15	.
16	0.001
17	.
18	.
19	.
20	.
21	.
...

Notice that the blocks are not constant (some are 5, some are 6 etc. -this is just a portion of the data-). My difficulty lies in the fact that there is no natural grouping variable. I tried a mixture of subscripting and sequence generating commands, but did not get too far. The crucial part is that I need to place the non-missing pvalue at the beginning of the block, while right now it is at the end.

--
Thomas Speidel

*
*   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