******PERCENT OFF MACRO; *Laura A. Higgins 18 May 2005; *This macro will set up the detection to calculate the percent off of Absent from the Affy criteria of Detection = Absent, Maybe, Present; *YOU will still need to write a percent calculation (below, but not part of the macro) for all the detection_variable_name used; *This assigns absent = 1, present = 0 and maybe = 0; %macro Percent_Off(detection_variable_name, data_in); data binary_&detection_variable_name; set &data_in; if &detection_variable_name = "A" then off_&detection_variable_name = 1; else off_&detection_variable_name = 0; keep gene_name off_&detection_variable_name; run; *sorts files to merge; proc sort data = &data_in; by gene_name; run; proc sort data = binary_&detection_variable_name; by gene_name; run; *merge all files back with original; data &data_in; merge &data_in binary_&detection_variable_name; by gene_name; run; %mend Percent_Off;