Page 2 of 2
Re: How to select one entity's time series from a panel data
Posted: Sun May 01, 2011 8:28 pm
by Steve06
thanks, your continuous support is highly appreciated.
it works provided you have no sample restriction before running these lines (i.e. had to do "smpl @all" before)
now, inside my loop
Code: Select all
for !i=1 to !ncross
smpl if @crossid = !i
'do something here
next
how can i obtain the current id value (the real one) being processed?
!id=@crossid throws the same error as the one before
Re: How to select one entity's time series from a panel data
Posted: Sun May 01, 2011 8:40 pm
by EViews Gareth
!i
Re: How to select one entity's time series from a panel data
Posted: Sun May 01, 2011 8:54 pm
by Steve06
!i would just return the current level of the counter !i (e.g. 1 through 500)
but my id values are non-sequential and do not start at 1, e.g. 1001, 1005, 1016...
these are the ones i'd like to retrieve
Re: How to select one entity's time series from a panel data
Posted: Sun May 01, 2011 9:10 pm
by startz
Remember that once you've smpl if to pick a cross-section, then you've selected the sample for all the variables. So if you have a variable named cross_section_name_or_whatever,
Code: Select all
for !i=1 to !numcross
smpl if @crossid = !i
show cross_section_name_or_whatever
next
Re: How to select one entity's time series from a panel data
Posted: Sun May 01, 2011 9:26 pm
by Steve06
ok, but i need the current value to be stuffed into a temporary variable !current_id_value ...
let's say my identifier variable is called myid
myid(xxx) does not do the job since the reference inside the brackets is relative to the whole range, not the current sample, otherwise it would be straightforward to just have !current_id_value=myid(1), but this obviously doesn't work
Re: How to select one entity's time series from a panel data
Posted: Mon May 02, 2011 6:53 am
by startz
Try @first(myid)
Re: How to select one entity's time series from a panel data
Posted: Mon May 02, 2011 9:15 am
by Steve06
yes, this seems to work! problem resolved. thank you.