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!!!