There seems to be little guidance online regarding this error message.
In essence, I want to generate new variables from multiple response variables from a survey. I found guidance that the error message may be linked to a long varname. This is, however, not the complete story.
I have the varlist aboutjournal1-aboutjournal40. These have concatenated responses (1,2,3), (1,2), (1,3), (2,3), (1), (2), (3). I want to split these into separate variables and destring.
The following:
The ideal code would look as follows:
However: The above code gives the error message "cannot generate new variables using stub j1". Surprisingly, if I instead only use the rename function for one specific variable, aboutjournal1, the code below comes without error.
How can I solve this error message, and why does it appear?
In essence, I want to generate new variables from multiple response variables from a survey. I found guidance that the error message may be linked to a long varname. This is, however, not the complete story.
I have the varlist aboutjournal1-aboutjournal40. These have concatenated responses (1,2,3), (1,2), (1,3), (2,3), (1), (2), (3). I want to split these into separate variables and destring.
The following:
The ideal code would look as follows:
Code:
rename aboutjournal# j# split j1, parse(,) // to be repeated for each aboutjournal in a for loop.
rename aboutjournal1 j1
split j1, parse(,)
split j1, parse(,)

Comment