What I want to do is to generate a new variable y following some self-defined function f() and existing variable x. For example, f(x)=x^2.
My question is how to define a program or a function that has argument x and would output a new variable y when I cite it using gen y=f(x) or f x?
I know this example can be done simply by gen y=x^2, but I need to use this structure to do some further programming. Thanks for your help!
My question is how to define a program or a function that has argument x and would output a new variable y when I cite it using gen y=f(x) or f x?
I know this example can be done simply by gen y=x^2, but I need to use this structure to do some further programming. Thanks for your help!
Comment