Does anyone know if it's possible to either operate on every other column of a dataset or (preferably) load mixed data types into an array (even possibly a multidimensional one, if needed) in SAS? I have a huge dataset where the columns alternate between numeric and character and I need to operate identically on all the columns, regardless of type. Of course, I can do this easily by outputting the numeric columns to one dataset and the character to another, but given the size of these datasets, I am not thrilled with this solution since I would have to iterate over the dataset at least three times, and I'd rather just make one pass through the data. I suppose I could also do something like this in IML, but I'd prefer to stick with base SAS. I'm consdiering switching to R and this might be the nail in the coffin if I can't find a workable solution in SAS.
I tried to do something likes this:
data work.temp;
set work.temp;
array myarray {*} $ Char_Q2 Numeric_Q3;
do i=1 to 4 by 2;
/* operations would go here here */
end;
run;
but, this throws the error:
ERROR: All variables in array list must be the same type, i.e., all numeric or character.
Any ideas?
Thanks.
... View more