Dear Statalist,

I would like to define an e-class program but have no idea how to -ereturn- a pseudovariable (xx in my example) like the -e(sample)-. Such a pseudovariable would be used in the following post-estimation command so I tried to use -eret post-. But I couldn't find how to do it from the help file for -eret-.

Any suggestions are appreciated!

Kind regards,
Yugen


Code:
// x = [1,2,3,4,5,6]
// y = [1,1,1,1,1,1]

clear all

program define myprograme 

args y x 

marksample touse 

preserve

quietly: keep if `touse'

qui: gen xx = x-3
qui: replace xx = 0 if x<0

/* some operations on y and x and xx */

restore 

// ereturn xx and get a psuedovariable like e(sample) 

end