I'm creating a number of new variables, and I want each variable type to be based on the type of the old variable. I don't want to do this manually--I have a script to automatically create the new variables based on the names of the old variables, so I'd like it to additionally automatically detect the type of the old variable.
Obviously I have variables of both type string and numeric.
Any ideas?
Another route, if the above is not possible, would be to duplicate the base variable, and then set the values to $sysmis. But then, how can I duplicate the variable?
Thanks!
EDIT, in response to commenter JKP: I'm restructuring a large longitudinal data set using the varstocases syntax. Every variable is not at every timepoint, so I need to create the missing variables so that they will be properly indexed during the restructure.
So, Var_t1 and Var_t3 exist, but when restructured, Var_t1 would get an index of 1, and Var_t3 would get an index of 3. So I need to create an empty Var_t2 in order to /make Var from Var_t1 Var_t2 Var_t3.
Of course, to restructure, the variables have to all be of the same type.
As an aside, this seems to me to be a very convoluted way of doing this, but it seems to be the only option I'm aware of in SPSS.