Statalist


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

Re: st: Conditional operatior trouble


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Conditional operatior trouble
Date   Mon, 15 Sep 2008 07:53:40 +0100 (BST)

You seem to be using Mata operators in Stata. That will not work. A
list legal operators in Stata can be found by typing -help operator-.
But before you start inventing your own functions, take a look at:
-help dates_and_times##extracting-

-- Maarten

--- Ashim Kapoor <ashimkapoor@gmail.com> wrote:

> 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/
> 


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index