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
Help with creating a variable with lagged valuesHey guys, I am currently a final year student and i am writing my Economics dissertation on Oil pri…
How compare categories from a one variable they are the same among 10 data sets.Hello everybody, I’m working whit 10 data sets from the household survey, and I want to know if in a…
Help with loopHi, Getting used to the program. I'm having some trouble with a loop. In the first column of the da…
Estimate risk for groupsCiao Here is the example using Stata data. Code: use http://www.stata-press.com/data/r13/drugtr …
How do i list ALL underlying codes for a variabel?I have a long list of diagnostic codes, which all have an underlying code that i need to use when wa…
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