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" <gwkhanna@hotmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Dropping Subset of Variables
Date   Fri, 30 Mar 2007 08:07:37 +0000

Dear Neil, Sergiy and Michael,

Thank you for your suggestions. I tried what each of you had recommended and it worked. I used two loops.

Sergiy-you figured that I was using NFHS98!

And Neil in response to your comments on memory issues, indeed I am running into these problems. My 4 yr old laptop starts revolting and just freezes. -set virtual on- does not help. Am trying to make my laptop endure this last piece of data work for my PhD.

Thank you once again.

Gauri


From: "Neil Shephard" <nshephard@gmail.com>
Reply-To: statalist@hsphsun2.harvard.edu
To: statalist@hsphsun2.harvard.edu
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.

Neil

On 3/29/07, Gauri Khanna <gwkhanna@hotmail.com> wrote:
Dear
Stathttp://by112fd.bay112.hotmail.msn.com/cgi-bin/compose?type=r&msg=263177E0-0CC4-4C00-925F-222FD8AFB647&start=0&len=5011&curmbox=00000000%2d0000%2d0000%2d0000%2d000000000001&a=8e97f2d6d33d18578baf68a0a3ed453816fb536984f31fb688a5332731eba969#
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?

Variables:
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.

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

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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


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

Email - nshephard@gmail.com / n.shephard@sheffield.ac.uk
Website - http://slack.ser.man.ac.uk/
Photos - http://www.flickr.com/photos/slackline/
*
*   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/
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index