"ERROR: The text expression length (65535) exceeds maximum length (65534). The text expression has been truncated to 65534 characters."
if there are many strata of exact matching variable values (1000's of values), because the durations are saved as a decimal
numbers, and if there are many of these, the expression can become very long. To fix this, save duration times in a dataset and summarize the duration using a SAS procedure instead.
Below code illustrates the problem and a possible solution:
The following lines https://github.com/thomas-rasmussen/sas_macros/blob/946b8b376f62ed4a8b3583dccb58a960a808c3b1/hash_match.sas#L1037-L1039 will produce errors like
"ERROR: The text expression length (65535) exceeds maximum length (65534). The text expression has been truncated to 65534 characters."
if there are many strata of exact matching variable values (1000's of values), because the durations are saved as a decimal numbers, and if there are many of these, the expression can become very long. To fix this, save duration times in a dataset and summarize the duration using a SAS procedure instead.
Below code illustrates the problem and a possible solution:
%let duration = 0.000000000000000000000000000000000000000000000000000000000000000001;
%macro _tmp; %do i = 1 %to 1000; %put i: &i; %if &i = 1 %then %let duration_all = &duration; %else %let duration_all = &duration_all &duration; %end; %put &duration; %mend _tmp; %_tmp;
%macro _tmp1; option nonotes; %do i = 1 %to 1000; %put i: &i; %if &i = 1 %then %do;; data duration; duration = &duration; output; run; %end; %else %do; data duration; set duration; if n = 1 then do; output; duration = &duration; output; end; output; run; %end; proc sql noprint; select median(duration) into :median_duration from duration; quit; %end; %put &duration; option notes; %mend _tmp1; %_tmp1;