Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Working with time series operators and loops in If Qualifier

Subject   st: Working with time series operators and loops in If Qualifier
Date   Thu, 05 May 2011 17:48:37 +0200

Dear stata  experts,

I am trying to integrate time operators and a loop in a if qualifier.

Here is my code:

forvalues x = 1/10 {
forvalues z = 1/100 {

gen hrec_`z'_`x' = 0

gen hrec_start_`z'_`x' = 0

replace hrec_`z'_`x' = 1 if L(1/`x').(abc >= `z'/100) & ( vw >= 0 | dvw >=0)

replace hrec_start_`z'_`x' = 1 if hrec_`z'_`x'==1 & L1.hrec_`z'_`x'==0

replace hrec_`z'_`x'=0 if (abc < `z'/100 | vw<=0) & hrec_start_`z'_`x' ~=1

Stata wont let the time operator L(1/`x') work in the if qualifier and I understand the reason for this. Unfortunately, I have no clue how to write the code of this instead. 

I want the if qualifier to check if 1 to x lagged values are above a numerial value without typing every single qualification. Do you have any advice how to solve this problem?

Thanks a lot,


NEU: FreePhone - kostenlos mobil telefonieren und surfen!			
Jetzt informieren:
*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index