Hello everyone, I am trying to figure why does using the generate command with a local results in the error "Too few variables specified", but it works fine when used with a variable?
Below is my code, trying to generate a variable/macro based off of arguments given to be later used in running a DID regression. The problem lies in when generating the `K' macro. It does not work with `K', but works fine with the variable K. Why is this? Thank you for your answers in advance!
Below is my code, trying to generate a variable/macro based off of arguments given to be later used in running a DID regression. The problem lies in when generating the `K' macro. It does not work with `K', but works fine with the variable K. Why is this? Thank you for your answers in advance!
Code:
program define testfunction, eclass sortpreserve
version 17.0
syntax varlist(min=5 max=5)
/*initialize variables*/
tokenize `varlist'
local Y `1'
local i `2'
local t `3'
local ei `4'
local group `5'
gen K = (`t' - `ei')
end

Comment