Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Conditional operatior trouble


From   "Ashim Kapoor" <[email protected]>
To   [email protected]
Subject   st: Conditional operatior trouble
Date   Mon, 15 Sep 2008 12:08:06 +0530

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index