I have a table and I want to change the name of some columns using macro. The initial names are Bucket1-Bucket96 and I want to change them to time intervals. for example change Bucket 1 to 00:00:00-00:14:59, Bucket2 to 00:15:00-00:29:59 and so on. this is my code t1 is the current table I have I appreciate if you can help me data column_name; data column_name;
length myVar $ 1000;
*myVar='';
time='00:00:00't;
i=0;
do hour = 0 to 23;
hours=intnx('HOUR',time,hour,'b');
do minutes = 0 to 45 by 15;
i=i+1;
begin=intnx('MINUTE',hours,minutes,'b');
begin_char=put(begin,tod8.);
end=intnx('MINUTE',begin,14,'e');
end_char=put( end,tod8.);
myVar=catx(' ',myVar,' ',cats('BUCKET',i,'=',cats('"',catx('-',begin_char, end_char),'"n')));
end;
end;
/* call symput('rename_list',myVar);*/
run;
%Put &myVar;
data t2;
set work.t1;
rename &myVar;
run;
... View more