Delete estimated equation

For questions regarding programming in the EViews programming language.

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

stefanp
Posts: 63
Joined: Wed Sep 30, 2015 12:24 am

Delete estimated equation

Postby stefanp » Fri Mar 17, 2017 2:13 am

I intend to delete an estimated equation depending on some criteria. In fact, there is a series "value" that equals 2 for each obsid in each cross section, except for one obsid. For each cross section, there is exactly one obsid at which value<1 holds. Furthermore, I have estimated equations with different periods for each cross sections.

Suppose there are the following estimated equations:
aa_1
aa_2
aa_3
bb_1
bb_2
bb_3
where aa and bb are cross sections and 1 and 2 indicate the different estimation periods. Suppose the series "value" equals 0.5 for aa_2 and 0.6 for bb_1 (else 2). I would like to run a loop that deletes all equations unless "value"<1, i.e. keep aa_2 and bb_1 only.

Code: Select all

   for !i=1 to 3
   string q=@str(!i)
   for %jj aa bb
         smpl @first+!i-1 @first+!i-1  if ident=%jj
         if value>1 then         
         delete {%jj}_{q}
         endif
   next
   next


However, it does not work. Any suggestions?
Last edited by stefanp on Fri Mar 17, 2017 8:33 am, edited 1 time in total.

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

Re: Delete estimated equation

Postby EViews Gareth » Fri Mar 17, 2017 8:32 am

if statements have to evaluate to a single scalar value. Thus you can't use them on an series. Try using:

Code: Select all

if @max(value)>1 then
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 15 guests