How do I refer to a variable that might not be included in the varlist of a program?
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:
when I invoke the program with
it works all fine. If I try
I get invalid syntax.
I appreciate your help
Magnus
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'" == "" end
Code:
try var1 var2
Code:
try var1
I appreciate your help
Magnus
Comment