Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: newbie question on replacing variables in do file

From   Richard Williams <>
Subject   Re: st: newbie question on replacing variables in do file
Date   Fri, 13 Feb 2004 23:54:43 -0500

At 08:18 PM 2/13/2004 -0800, Alan Acock wrote:
When I run a series of commands to generate new variables in a do file and
realize I made a mistake on one of them, I would like to fix the mistake,
highlight the section of commands, and run the selection. When I do this,
Stata says the generated variables already exist. Sooooo, I need to drop
each variable I created in the series of commands, and then re-run them. I
assume this is a way Stata has to prevent accidently replacing a variable.
QUESTION: How can I have the gen and egen commands replace the variables I
want it to replace rathr than having to first drop them???
Alan Acock
Yes, I wish there was an option that let you throw caution to the wind. Stata protects users from themselves more than Spss does.

Instead of -gen-, use -replace-. Type -help replace- for more details.

I don't know of a similar command for -egen-. It seems odd that there isn't, but maybe I am just missing it.

Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: Richard.A.Williams.5@ND.Edu
WWW (personal):
WWW (department):

* For searches and help try:

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