sample command in panel

For questions regarding programming in the EViews programming language.

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

JhonnyCa
Posts: 6
Joined: Tue Feb 17, 2015 11:32 am

sample command in panel

Postby JhonnyCa » Tue Aug 04, 2015 4:33 am

Hi,
I'm using a dated panel with monthly observations and 2000 cross-sections (stocks). How can I "mark" certain cross sections by looking at a variable (e.g. market cap.>100) in one month, t, and take the same cross-sections in a sample command the next month, t+1, (even though their market cap. has for example decreased in month t+1 and would no longer fulfill the original if-condition from month t).
I hope I have been clear, I would very appreciate any help!

JhonnyCa
Posts: 6
Joined: Tue Feb 17, 2015 11:32 am

Re: sample command in panel

Postby JhonnyCa » Tue Aug 04, 2015 5:10 am

So if, for example, the following sample command for month 10 (trend=10) yields 200 stock-months...

smpl @all if trend=10 and if marketcap<100

...I then want to include the same 200 stocks in month 11 (trend=11), regardless the value of their marketcap

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: sample command in panel

Postby EViews Glenn » Tue Aug 04, 2015 7:45 am

If I understand correctly, I think something like this should work.

Code: Select all

smpl @all series keep = @recode(@trend=10 and marketcap<100, 1, 0) smpl if @sumsby(keep, @crossid)>0


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests