Programming a series with some zeros to fill in another number

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Programming a series with some zeros to fill in another number

Postby miorinnovo » Wed Feb 26, 2020 2:42 pm

I have some series that have some observations valued at 0. Is there a way to automatically have all 0 observations changed to 1 without having to explicitly tell the program the dates?

For example, I know
smpl sample

Code: Select all

variable.fill(s) 1
would work if I make the sample the exact date of the 0, but with many zeros it would get cumbersome so id like eviews to automatically find and replace zeros. Is that possible?

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: Programming a series with some zeros to fill in another number

Postby startz » Wed Feb 26, 2020 2:45 pm

Maybe

Code: Select all

smpl if s=0 s=1 smpl @all

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Re: Programming a series with some zeros to fill in another number

Postby miorinnovo » Wed Feb 26, 2020 2:46 pm

amazing. thanks!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: Programming a series with some zeros to fill in another number

Postby EViews Gareth » Wed Feb 26, 2020 2:54 pm

Code: Select all

s = @recode(s=0,1,s)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests