Hi
I have a series with 65,000 observations where the value varies from 1 to 12
I need to find values 1 to 3, 4 though 6, 7 through 9 and 10 through 12 then generate a new series containing values of 1, 2, 3, or 4 in the approrpiate cells
I've been attempting this with the following code to no avail
Any suggestions would be appreciated
program mytest
workfile test u 1 65535
fetch allbids09:: openingdate
' transforming date string to common units
series test=@datepart(openingdate, "mm")
series test2=@datepart(openingdate, "yy")
if test >=1 and test <=3 then
series qrtr =1
if test >3 and test <=6 then
series qrtr2=2
if test>6 and test <=9 then
series qrtr3=3
'if test>9 and test <=12 then
series qrtr4=4
endif
endif
endif
endif
search x and replace with Y IF (eviews 7)
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: search x and replace with Y IF (eviews 7)
You can't use IF statements on series.
Either assign a binary test to the series directly (with no if):
or use the @recode function
or use the smpl statement:
Of course, looking through your earlier code, it might be simpler to just do:
Either assign a binary test to the series directly (with no if):
Code: Select all
series qrt1 = test>1 and test<=3
Code: Select all
series qrt1 = @recode(test>1 and test<=3, 1, 0)
Code: Select all
smpl if test>1 and test<=3
series qrt1 = 1
smpl @all
Code: Select all
series qrt1 = @datepart(openingdate, "q") = 1
Re: search x and replace with Y IF (eviews 7)
thanks - would have taken me a week
have 2 beers on me
have 2 beers on me
Who is online
Users browsing this forum: No registered users and 2 guests
