Hi everyone,
This might have a simple solution but I'm stuck.
I have a set of variables that goes like qn2_2__10 qn2_3__10 qn2_3a__10 head__10 qn2_4__10 qn2_5__10 qn2_6__10 qn2_8__10 qn2_9__10 qn2_10__10
I want to remove one space i.e. "_" from these variables (eg change qn2_2__10 to qn2_2_10) and the command rename *_# *#works but it removes one space "_" for all the variables in my dataset. Is there a way I can limit it to only the required variables?
I thought I may get lucky by using a loop (below) but it also performed the change in the whole dataset.
foreach var of varlist qn2_2__10-qn2_10__10 {
rename *_# *#
}
Related Posts with Removing middle character from a set of variables
coefplot - creating a vertical coefficient plot with multiple lines across the entire x-axisDear Stata users, I'm having a problem creating a coefficient plot with Stata that produces vertica…
Survey data: Make a decision between Poisson regression and Negative binomial regressionDear Stata users, I hold a question here: I am using survey data and deciding which regression mode…
Predict commandHi, I estimated the probability of default of loans using borrower characteristics. First, I run a …
Clusteff command for panel dataDear Statalisters, could anyone tell me whether the command "clusteff" can also be applied to panel …
Rolling percentiles for large datasetHi, I have a large dataset containing more than 30m observations. The dataset aggregates daily trad…
Subscribe to:
Post Comments (Atom)
0 Response to Removing middle character from a set of variables
Post a Comment