Hello. I have a custom program that is designed to format some tables of results based on a regression function (eg logistic) and a varlist. I previously used just a namelist for the regression function and the varlist, and it worked great. However, I now need to allow it to accept factor variables. I cant use just a varlist(fv) because this wont allow me to also use the regression function. I tried to use a namelist followed by a varlist(fv), but this does not work due to a syntax error. Can you tell me why?
For example, if I run this: (took out the actual code since it doesnt matter for this problem)
and use
I get the result which repeats the input namelist as expected:
However, if I change the program to use a namelist for the regression function and a varlist for the variable input, this syntax error occurs.
Ive read on other threads that it may not be possible to use both a namelist and a varlist in a single program syntax.... Is this true? If so, how can I accomplish what I need to do while allowing factor variables?
thanks for your help!
hpw
For example, if I run this: (took out the actual code since it doesnt matter for this problem)
Code:
capture program drop testprog version 17 program define testprog syntax namelist di "`namelist'" end
Code:
testprog logistic age bmi
I get the result which repeats the input namelist as expected:
Code:
. testprog logistic age gender logistic age gender
However, if I change the program to use a namelist for the regression function and a varlist for the variable input, this syntax error occurs.
Code:
capture program drop testprog version 17 program define testprog syntax namelist(max=1) varlist di "`namelist'" end
Code:
. testprog logistic age gender invalid syntax
Ive read on other threads that it may not be possible to use both a namelist and a varlist in a single program syntax.... Is this true? If so, how can I accomplish what I need to do while allowing factor variables?
thanks for your help!
hpw

Comment