In a program, that is often much better, especially if you want to remove several names (more generally "words") at once. Here, however, is a quite different solution. A Stata macro can contain multiple elements it has a name and contents. The method can be used to remove cluster confounding due to observed confounders by. The -local- command is a way of defining macro in Stata. In some older versions of Stata there were rather strict limits on string length for such functions, which made use of the construct used above : subinstr advisable for all but very short lists. Here we introduce another command -local-, which is utilized a lot with commands like foreach to deal with repetitive tasks that are more complex. replace ZZZ with a real OID once it is - allocated and remove this note.
patients with breast cancer and are available in the file polymorphism.dta (Stata file) DUP 09.
See also the functions subinstr() and subinword() for approaches similar in spirit. Kalyan (Srinivas)Tata <> Thu, 10 June 2010 19:37 UTCShow. To achieve this, we can remove the var.equalTRUE.But if they offend, they can be reduced to single spaces. When handling lists of variable names, Stata doesn't care about multiple spaces rather than single spaces, so neither need you. local names : subinstr local names "pig" "", word Reshaping is often needed when you work with datasets that contain variables with some kinds of sequences, say, time-series data.
In Stata, words are or could be separated by spaces (other than being bound by double quotes) in the case of Stata variable names, distinct variable names are always distinct words. In this post, I use a few examples to illustrate the two common data forms: wide form and long form, and how to convert datasets between the two forms here we call it reshape data. The solution is to insist that what is removed must be a word.
Thus the result of removing pig from this list with equivalent but not identical syntax is. The subinstr() solution in the OP's answer works only if the text to remove occurs just once as an entire variable name, and does not occur as part of another variable name. The context is that you want to remove variable names from a string listing them.