@RW9 Good point. Another school of thought is that numeric variables should only be for values that can be used for calculations, and other values (like IDs) should be strings. Strings do need to use exact values ( '9' is not the same as ' 9' or '09' ) but this is not necessarily detrimental. I reckon the difference is just something to be aware of, not a reason to always use one or the other.
As for speed, strings can be be faster when merging.
data T1 T2; do I=1 to 1e8-1; output; end;
data _null_;
merge T1 T2; by I;
run;
*NOTE: DATA statement used (Total process time):
real time 27.15 seconds
user cpu time 25.14 seconds
system cpu time 2.01 seconds;
data T1 T2; do I=1 to 1e8-1; A=put(I,z8.);output; end; drop I;
data _null_;
merge T1 T2; by A;
run;
*NOTE: DATA statement used (Total process time):
real time 25.58 seconds
user cpu time 23.13 seconds
system cpu time 2.44 seconds;
... View more