I have a set of variables, some of which are string and some numeric. Here is a view of a small number of them.
I'd like to loop through these variables using foreach and perform a recode on the numeric variables. I tried determining if the variable was string or numeric by looking at its type. However, this is not elegant because some of the numeric variables are integers, some float etc hence there are different types for different kinds of numerics, and the string variables have different lengths, hence type is different from variable to variable there too. Is there some quick way to distinguish numeric from string variables? It occured to me to do some simple numeric operation, e.g.
which would fail for string variables and allow me to skip over them, but I must be missing something.
Code:
FDC_ACCU_dose byte %10.0g FDC_BENICAR_d~e byte %10.0g FDC_BISOP_HC~se str6 %6s FDC_ENAL_HCT~se byte %10.0g FDC_HYZ_dose byte %10.0g FDC_LIS_HCTZ~se str7 %7s FDC_TRIA_HCT~se str7 %7s
Code:
var * 1
Comment