Hello to everyone. I really hope someone can help me with this. I have a dataset in which I am running a code that "resembles" a sort of vlookup. To do that, I took the code from here https://www.statalist.org/forums/for...ror-in-vlookup.
clear input id matchid d_date 102 351 21246 232 283 . 280 426 21244 283 232 21266 351 102 . 426 280 . end tempfile master save `master' * confirm that d_date is unique within id bysort id (d_date): assert d_date[1]==d_date[_N] * create lookup table bysort id (d_date): keep if _n==1 drop matchid rename (id d_date) (matchid d_date_match) tempfile lookup save `lookup' * merge lookup to master use `master', clear merge m:1 matchid using `lookup' sort id list, clean noobs abbreviate(12)
Now everything works perfectly. The problem is that, if I do not write the command "by hand" and simply run a do file, I get an error message (I understood that the error comes from the space at the end of the line code in the do file).
Basically when I run the line in my do file: save `master' or save `lookup', the command also take one space at the end of the line: save `lookup'_ and gives me the following error: invalid file specification
How can I overcome it and just run the do file without beign forced to always write manually the command without spaces?
Thanks in advance!!!
Related Posts with Tempfile and error due to "spaces" at the end of a do-file line
could not calculate numerical derivatives -- flat or discontinuous region encounteredDear all, I am trying to run the stochastic frontier model based on Battese and Coelli (1995), whic…
Summary Statistics for Categorical VariablesDear Statalist, I used the following command Code: sum influenced ibn.size and was wondering if …
qregpd application explanationDear all, I am attempting to estimate the effect of temperature and precipitation (at the district …
How to generate equationsHi, I'm creating a new dummy variable such that a = b/c if d = chocolates or sweets, else a = b*c. …
Count drought years for previous 7 years, by groupI've got a dataset set up roughly like the below. The variable "drought" is equal to 1 if that year …
Subscribe to:
Post Comments (Atom)
0 Response to Tempfile and error due to "spaces" at the end of a do-file line
Post a Comment