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

st: RE: sub-dataset by variable numbers

From   "Soremekun, Seyi" <>
To   <>, "Jian'an Luan" <>
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:
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.


-----Original Message-----
[] On Behalf Of Jian'an Luan
Sent: 02 October 2007 12:05
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.

*   For searches and help try:

*   For searches and help try:

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