Statalist


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

Re: st: Inserting a row in the data table


From   "Kartick Gupta" <[email protected]>
To   <[email protected]>
Subject   Re: st: Inserting a row in the data table
Date   Thu, 20 Sep 2007 23:40:14 +1200

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.  

Thanks

Regards
Kartick



>>> "Sebastian F. Büchte" <[email protected]> 09/20/07 11:21 PM >>>
Kartick

looking at your example it seems more to be a sort problem. Try

gsort ABC, mfirst

This will sort your data by entries in ABC in ascending order with
missing values first.

If you would like to add observations to a dataset, you could use
-expand-. This command allows you to add extra observations by copying
existing ones, e.g., expand 2 in 1 will append a full copy of your
dataset's first observation and append it to the very end of the
dataset. Find out more about -expand- with -help expand-.

Sebastian



2007/9/20, Kartick Gupta <[email protected]>:
> Hello all,
> Is it possible to insert a row in the data table? I know it is
possible by running some simple program, but is there any function
already available in Stata?
>
> For example,
>
>    ABC      --change to--->          ABC
> 1   x                                            .
> 2   y                                            x
> 3   z                                            y
> 4   .                                             z
>
> Regards
> Kartick
>
>
>
> *
> *   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/
>
*
*   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/

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