Statalist The Stata Listserver

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

Re: st: Dropping Subset of Variables

From   "Gauri Khanna" <>
Subject   Re: st: Dropping Subset of Variables
Date   Thu, 29 Mar 2007 09:41:36 +0000

Dear Neil,

Thanks for your prompt reply.

Unfortunately, the wild card does not help because I have other variables in my data set that have _02, _03 etc. attached and which I may want to keep. I want to try and get rid of these listed variabls only with the _02 to _46 suffix.

Is there any way around this barring doing it individually for each variable?

I looked through the manual and users guide but did not get any inspiration.



From: "Neil Shephard" <>
Subject: Re: st: Dropping Subset of Variables
Date: Thu, 29 Mar 2007 10:32:11 +0100

You could try using the -keep- command with wild-cards...

keep *_01

..should do the trick.  See -man keep- and section 11.2.3
Variable-name abbreviation in the Stata Users Manual.


On 3/29/07, Gauri Khanna <> wrote:
Senda List,

I have a large housheold survey dataset which includes the variables listed
below. I would like to drop variables with _02 to _46 and only keep the _01
ones. How can I do this?

hvidx_01 to _46 (i.e. hvidx_01, hvidx_02 ... hvidx_46)
hv101_01 to 46
hv102_01 to _46
hv103_01 to _46
hv104_01 to _46
hv105_01 to _46
hv106_01 to _46
hv107_01 to _46
hv108_01 to _46
hv109_01 to _46
hv110_01 to _46
hv115_01 to _46
hv116_01 to _46
hv117_01 to _46

Just for your information, variables with "_01" refers to information for
the household's head which is what I am interested in. The others "_02...
_04" refer to other members of the household.

Thank you for your help.

Dept. of Economics
Graduate Institute of International Studies (IUHEI)

Express yourself instantly with MSN Messenger! Download today it's FREE!

* For searches and help try:

"Every great advance in natural knowledge has involved the absolute
rejection of authority."  - Thomas H. Huxley

Email - /
Website -
Photos -
*   For searches and help try:
Don't just search. Find. Check out the new MSN Search!

* For searches and help try:

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