Statalist


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

Re: st: Inserting a row in the data table


From   "Scott Merryman" <[email protected]>
To   [email protected]
Subject   Re: st: Inserting a row in the data table
Date   Thu, 20 Sep 2007 07:05:24 -0500

You can use -set obs #- to add observations.

For example:

sysuse auto,clear
gen t =  _n
count
set obs `=r(N) + 1 '
replace t = 0 in `=r(N) + 1 '
sort t
drop t

// or use Roger Newson's -ingap-
sysuse auto,clear
ingap


Scott


On 9/20/07, Kartick Gupta <[email protected]> wrote:
> Hello Sebastian,
> Thanks for your suggestion. However, -gsort- may not be helpful. For
> example, if there is no missing data and still I want to insert a row in
> 1, gsort will fail. I think -expand- will only work for duplicate
> options. By using [_n] function, the problem can be solved, but that
> might not be effective utilization of time given that I have to repeat
> for a large number of variables.
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index