I have multiple sheets of excel that I import one by one into Stata. Each of the sheets has about 150 variables. The suffix of the variables is always either *_dum or *_yr. In Stata, I want to keep the label of *_dum, and the value of *_yr.
Regardless of the number of variables and the specific prefixes in each sheet, I want to create a code that will replace the variable label of those that end with "_yr" by the label in "_dum", if they have the same prefix. Prefixes will vary depending on the Excel input.
For instance 7_2_2_1_dum label needs to replace 7_2_2_1_yr label. Having both the label and the value that I want in 7_2_2_1_yr, I can now drop 7_2_2_1_dum.
Thank you.
Related Posts with Replacing variable labels if same prefix, different suffix
residual plot - examining outliersDear all, currently, I am working on a project on capital structures. This project is made with a O…
To transform cross-section data to panel dataDear Sir/Madam, I am doing the research on commercial jet aircraft, and each sample has "lease star…
How to validate logit model?Hi, any ideas how to validate the logit model in Stata? I have a received a comment that there is n…
Generate standard error of log (point estimate)Dear STATALIST, I am writing you as I am having some STATA issues regarding probably simple command…
Facing problem in analyzing unbalanced panel data / using gmm both system and differenceHi dear all i am getting the below error of not sorting of data before running gmm...can you share w…
Subscribe to:
Post Comments (Atom)
0 Response to Replacing variable labels if same prefix, different suffix
Post a Comment