Hi all,
I'm trying to run the following code where I try renaming a variable to a macro but it keeps failing.
foreach test in $Tests {
use "$crosswalk_path" if lcd == "`test'", clear
local testname = test[1]
capture noisily {
use "$data_extract_dir/`test'.dta", clear
merge m:1 msa date using "$data_extract_dir/Data.dta", ///
preserve
rename result `testname'
restore
}
}
The error message I keep getting is Syntax is rename oldname newname [, renumber[(#)] addnumber[(#)] sort ...] rename (oldnames) (newnames) [, renumber[(#)] addnumber[(#)] sort ...] rename oldnames , {upper|lower|proper}.
Can anyone help me fix this?
Related Posts with Can't rename variable to macro
mean +/- 2 stdDear Statalist, I am dealing with a variable that it is in between 0-1 (taking any possible value wi…
Margins from a mixed model with a log-transformed outcomeI run a mixed model of a log-transformed outcome using ‘mixed’ (and the dfmethod(kroger) option with…
Panel data modelHi, I have a panel dataset whereT=10 and N=77 and found the problem of heteroscedasticity, autocorre…
Changing datesHow can I change a date format in Stata for from this format 06/12/2021 to this format 06-12-2021 …
Wald test for trendsHi! I'm new to STATA. I came across a paper that reported a Wald-test for trends p-value along with …
Subscribe to:
Post Comments (Atom)
0 Response to Can't rename variable to macro
Post a Comment