I have simple program where I want to generate a variable t that es equal to the second argument. If there is no second argument I want t to be equal to the first argument:
Code:
cap prog drop try
prog try
syntax varlist
gen t = `2'
replace t=`1' if "`2'" == ""
endCode:
try var1 var2
Code:
try var1
I appreciate your help
Magnus
0 Response to How do I refer to a variable that might not be included in the varlist of a program?
Post a Comment