Hi,
I have a data set with 5 variables, with a 'slicer'. This is a sample from a larger dataset. I would like to loop each variable for analysis, namely tabstat.
I tried:
foreach x in sample_v sample_v_n sample_v_n2{
tabstat data if sample_v ==1, by(slicer) stat(n mean SD)
}
However, it reports x not found. Do I need to do anything different?
Thank you for your help!
I have a data set with 5 variables, with a 'slicer'. This is a sample from a larger dataset. I would like to loop each variable for analysis, namely tabstat.
I tried:
foreach x in sample_v sample_v_n sample_v_n2{
tabstat data if sample_v ==1, by(slicer) stat(n mean SD)
}
However, it reports x not found. Do I need to do anything different?
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(sample_v sample_v_n sample_v_n2 sample_v_n3 sample_v_n4 data slicer) 1 1 0 0 1 14520 1 0 1 0 1 1 8875 0 0 1 0 0 0 4564 1 1 1 0 1 0 452 0 0 0 1 0 1 0 1 1 0 1 1 1 1111 0 end
Comment