Sample command

For questions regarding programming in the EViews programming language.

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

GFXFTS
Posts: 42
Joined: Wed Nov 21, 2018 10:33 am

Sample command

Postby GFXFTS » Tue Mar 16, 2021 3:59 am

Hello,

How would I define a sample command which uses the last possible observations only if there is not an NA, please?

In the screenshot attached I would like to define the sample as:

smpl 15/03/2021 15/03/2021 (as all the values are available)

and then tomorrow

smpl 16/03/2021 16/03/2021

Thanks a lot.

Best,

Günter

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

Re: Sample command

Postby EViews Gareth » Tue Mar 16, 2021 8:44 am

a) no screenshot.

b) NA based on what? A series? A group? All series in the workfile?
Follow us on Twitter @IHSEViews

GFXFTS
Posts: 42
Joined: Wed Nov 21, 2018 10:33 am

Re: Sample command

Postby GFXFTS » Wed Mar 17, 2021 4:53 am

Hi Gareth,

Forgot the attachments, sorry.

The NAs concern the group "g_g10_pch" in the attached workfile.

For 16/03/2021 there are NA so I would like to move the sample to the previous day if possible via a command.

Thanks a lot.

Best,

Günter
Attachments
movers_shakers_spx_sectors_d.wf1
(1.03 MiB) Downloaded 136 times

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

Re: Sample command

Postby EViews Gareth » Wed Mar 17, 2021 7:18 am

If you want to exclude dates where there are any NAs:

Code: Select all

smpl if @robs(g_G10_pch)=g_g10_pch.@count


If you just want the last one excluded, it is a little more work:

Code: Select all

series fullobs = @recode(@robs(g_G10_pch)=g_g10_pch.@count, 1, na)
%last = fullobs.@last
smpl @first {%last}
Follow us on Twitter @IHSEViews

GFXFTS
Posts: 42
Joined: Wed Nov 21, 2018 10:33 am

Re: Sample command

Postby GFXFTS » Fri Mar 19, 2021 3:46 am

Perfect. Thanks a lot. Best, Günter


Return to “Programming”

Who is online

Users browsing this forum: Google [Bot] and 29 guests