My question is in the title. Many thanks!
-
Login or Register
- Log in with
cscript
sysuse auto
mata:
// draw 20% variables
sample_percent = 0.2
// number of variables in the dataset
nvar = st_nvar()
// number of variables to draw
sample = round(nvar*sample_percent)
// randomize the variable index list then draw
sample_vars = jumble(1::nvar)[1..sample]
// only keep selected variables
st_keepvar(sample_vars')
end
describe
Comment