data want;
set have;
array old_char (*) $ <list of character variables>;
array old_num(*) <list of numeric variables>;
array new_char(*) $ <list of new names>;
array new_num(*) <list of new names>;
array diff_char(*) $ diffC1-diffCn; *you may want to make new names here;
array diff_num(*) diffN1-diffNn;
*loop over character;
do i=1 to dim (old_char);
diff_char(i) = old_char(i) = new_char(i);
end;
*loop over numeric;
do i=1 to dim (old_num);
diff_num(i) = old_num(i) - new_num(i);
end;
run;
Sure, but please post back your macro so others can use it as well 😉
I ended up being wrong, you need 6 arrays, one for old/new/diff x 2 - one for character and numeric.
There should be an easier way.
Here's a PROC COMPARE example. You could transpose this output data set and get what you want I think and it's easier to wrap that in a macro program IMO.
data class_new;
set sashelp.class;
if age in (12, 13, 14) then height = height*2;
if age = 11 then delete;
run;
proc sort data=class_new;
by name; run;
proc sort data=sashelp.class out=class_old;
by name;run;
proc compare base=class_new compare=class_old outall out=want;
run;
@learn_SAS_23 wrote: Thanks reeza, Can you please send a sample code snippet for point number 4, using 4arrays to verify data, am just learning sas I made code for other points (1,2,3,5)
... View more