I think there is a typographical problem that has crept into your code somehow. When I create a suitable data set and directly type -gen x2= (d.revt - d.rect)/L.at- at the command window, it runs without error messages. When I then -drop x2-, and copy/paste your code (which looks the same to the eye) into the command window and run it, I get the same error message you do.
Dissecting your code a bit by creating a data set in which that one command is the actual data in an observation, the -charlist- command shows me that it contains 3 non-printing characters in addition to the ones we can see with our eyes. So I think all you need to do is delete that line of code from your do-file and then type it in directly from the keyboard and you'll be fine. If that's not the case, please post back and include an example of your data using the -dataex- command.
If the code was at any point passed through a word processing program or some other program (or maybe even the Statalist Forum editor), it can get "contaminated" with "control characters" used by that program. These characters are not recognized by Stata and can completely confuse the parser, leading to error messages, and sometimes error messages that are misleading.
Dissecting your code a bit by creating a data set in which that one command is the actual data in an observation, the -charlist- command shows me that it contains 3 non-printing characters in addition to the ones we can see with our eyes. So I think all you need to do is delete that line of code from your do-file and then type it in directly from the keyboard and you'll be fine. If that's not the case, please post back and include an example of your data using the -dataex- command.
If the code was at any point passed through a word processing program or some other program (or maybe even the Statalist Forum editor), it can get "contaminated" with "control characters" used by that program. These characters are not recognized by Stata and can completely confuse the parser, leading to error messages, and sometimes error messages that are misleading.
Comment