Hi All,

I am looking for a way to automate writing a command so that it adapts if I change the covariates. In particular, in the example below, I would want the last line (x2_r: _b[x2]/_b[x1]) (const_r: _b[_cons]/_b[x1]) to change depending on the variables used in the previous line, e.g. if I add x3 - (x3_r: _b[x3]/_b[x1]) will appear there or if I use oprobit instead of reg, it will contain cuts instead of constant.

Code:
clear all
set seed 12345
set obs 100

gen x1 = rnormal()
gen x2 = rnormal()
gen e = rnormal()
gen y = 2 + 3*x1 + 2*x2 + e

reg y x1 x2  
nlcom (x2_r: _b[x2]/_b[x1]) (const_r: _b[_cons]/_b[x1])
Intuitively, I'm looking for something similar to R paste function:
Code:
paste(covariate.names, collapse = " + ")
I would be very grateful for any advice.

Many thanks,
Katya