Page 1 of 1

Sample command

Posted: Tue Mar 16, 2021 3:59 am
by GFXFTS
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

Re: Sample command

Posted: Tue Mar 16, 2021 8:44 am
by EViews Gareth
a) no screenshot.

b) NA based on what? A series? A group? All series in the workfile?

Re: Sample command

Posted: Wed Mar 17, 2021 4:53 am
by GFXFTS
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

Re: Sample command

Posted: Wed Mar 17, 2021 7:18 am
by EViews Gareth
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}

Re: Sample command

Posted: Fri Mar 19, 2021 3:46 am
by GFXFTS
Perfect. Thanks a lot. Best, Günter