Statalist


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

st: RE: sub-dataset by variable numbers


From   "Soremekun, Seyi" <[email protected]>
To   <[email protected]>, "Jian'an Luan" <[email protected]>
Subject   st: RE: sub-dataset by variable numbers
Date   Tue, 2 Oct 2007 12:55:06 +0100

I don't think stata will allow variable names starting with numbers.

But if you want your list of variables in some kind of number-related
format, maybe you could rename all your variables as a series such as
A1, A2...etc...

You can do this en masse using Nick Cox's 'renames' programme code:
http://ideas.repec.org/c/boc/bocode/s388102.html
e.g renames price-age \ a1-a20 (if you have 20 different variables with
the first being 'price' and the last being 'age')
then you can use 'drop' or 'keep' to remove part of the dataset

drop a1-a12

But I'm sure you can do this anyway without having to rename your
variables (e.g. drop price-year), so you only need to use the renames
command if you really want to convert your variable names into some kind
of numerical-like list.

Seyi

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jian'an Luan
Sent: 02 October 2007 12:05
To: [email protected]
Subject: st: sub-dataset by variable numbers

Dear Statalist

I wonder if I can select a sub-dataset by variables without given
variable names but using variable numbers, something like the command
when select a sub-dataset by observations ".keep if _n>1001 & _n<2000".
 
Any help will be appreciated.
 
Jianan

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