I have time series data and a list of quarters that serve as breakpoints; I want to use the -cut- function of -egen- to create an indicator variable for these periods. For example:
This fails because cut is expecting a numlist, not a scalar, and it seems that Stata doesn't understand scalars like other languages understand variables. Is my only option this (excessively verbose) solution:
Basically, I want Stata to function like every other major programming language/statistical package (R, Python, MATLAB, C family). If this syntax isn't supported, what exactly is the purpose of scalars?
Code:
scalar define break1 = tq(1990q1) scalar define break2 = tq(2000q3) sysuse gnp96, clear egen period = cut(date), at(0, break1, break2)
Code:
scalar define break1 = tq(1990q1) scalar define break2 = tq(2000q3) sysuse gnp96, clear egen period = cut(date), at(0, `=break1', `=break2')
Comment