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

Re: st: Inserting a row in the data table

From   "Scott Merryman" <>
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
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


On 9/20/07, Kartick Gupta <> 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:

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