I have been given a dataset (it is a translation table) to use that is set up in a fairly disorganized fashion. It has multiple variables that contain the same type of IDs (although the values in each vary slightly). I need to merge all of these together into one variable, while keeping the other variables. When I try to use the tempfiles I have saved I receive an invalid file specification error, I'm guessing this is just a syntax error on my part, but I have been unable to find a fix through googling so far. My code:
tempfile baseDict
save "`baseDict'"
keep Main_ID
tempfile MainID
save "`MainID'"
foreach year in 2012/2016 {
use `baseDict'
keep *_`year'
rename ID_`year' Main_ID
tempfile yearIDs
save "`yearIDs'"
use `MainID'
merge 1:1 Main_ID using "`yearIDs'"
save "`MainID'"
}
Set trace seems to show the error ocurring right as the first use `baseDict' runs in the for loop. Any help is quite appreciated, thank you!
Related Posts with Syntax for using and merging multiple tempfiles
Extract different parts from one variableDear experts, I have a table like this: Year Violation Year 2010 2005,2006,2007,2008,2009,2010 B…
Subgroup analysis using mixlogit for DCEHi does anyone knows how to compare if 2 subgroup models are significantly different if they are est…
Store a new variable with unique observations and missing otherwiseHello, Can you please help me with the following issue: I want to compute returns (ret_eom) based o…
conditional ATE in treatment effects estimationHow can one obtain the average treatment effect (ATE) or average treatment effect on the treated (AT…
🙋 Equivalent of mat_capp in MataI am looking for the equivalent of mat_capp/mat_rapp commands in Mata. Specifically, I need to perfo…
Subscribe to:
Post Comments (Atom)
0 Response to Syntax for using and merging multiple tempfiles
Post a Comment