Hello everyone,
I am having trouble with the last line of the following code : -
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
gen week=1
gen dow=dow(stdate)
gen changeinweek=1 if dow< dow[_n-1]
replace week=( changeinweek==. ) ? week[_n-1] : week[_n-1]+1
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
It says " invalid ? "
Could someone please tell me what I am doing wrong ? In case someone
needs details I am assigning weeks to my data.
Thank you,
Ashim.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/