Page 1 of 1
dofor looping and smpl in stats
Posted: Tue Aug 25, 2015 11:41 pm
by fan
Hi Tom,
I would like to know how I can use
and
together. I tried
Code: Select all
dofor i = x1 x2 x3; stats(smpl=i) y; enddofor i
but it did not work. It only gives result for i = x1. Do I need to use special instructions here? Many Thanks
Re: dofor looping and smpl in stats
Posted: Wed Aug 26, 2015 7:34 am
by TomDoan
fan wrote:Hi Tom,
I would like to know how I can use
and
together. I tried
Code: Select all
dofor i = x1 x2 x3; stats(smpl=i) y; enddofor i
but it did not work. It only gives result for i = x1. Do I need to use special instructions here? Many Thanks
Use
stats(smpl=i{0}) y
The right side of SMPL (and some other options such as WEIGHT and SPREAD) is a formula, so you need I{0} to make sure it's evaluated as an element of a series.
Re: dofor looping and smpl in stats
Posted: Wed Aug 26, 2015 9:53 pm
by fan
TomDoan wrote:fan wrote:Hi Tom,
I would like to know how I can use
and
together. I tried
Code: Select all
dofor i = x1 x2 x3; stats(smpl=i) y; enddofor i
but it did not work. It only gives result for i = x1. Do I need to use special instructions here? Many Thanks
Use
stats(smpl=i{0}) y
The right side of SMPL (and some other options such as WEIGHT and SPREAD) is a formula, so you need I{0} to make sure it's evaluated as an element of a series.
Thank you for the quick reply