Dear Statalisters
For an example dataset like so
I want to extract the value of variable "students" and insert it into a string variable "statement" something like below
command
replace statement = "This Teacher has `=students[_n]' students in her class"
(2 real changes made)
But rather than getting the respective values I am getting the value of the first observation in both first and second obs.
On the other hand I want to get
Thanks in advance for any help.
For an example dataset like so
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(teacher students) str42 statement 1 50 "" 2 100 "" end
I want to extract the value of variable "students" and insert it into a string variable "statement" something like below
command
replace statement = "This Teacher has `=students[_n]' students in her class"
(2 real changes made)
But rather than getting the respective values I am getting the value of the first observation in both first and second obs.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(teacher students) str42 statement 1 50 "This Teacher has 50 students in her class" 2 100 "This teacher has 50 students in her class" end
On the other hand I want to get
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(teacher students) str43 statement 1 50 "This Teacher has 50 students in her class" 2 100 "This Teacher has 100 students in her class" end
Comment