This is my first SAS assgnmt so my question is really basic.
I have a table which can has 2 fields Fld, Attr. Now I am doing a transpose on this table, so the no. of 'Fld' and 'Attr' really depends on data. eg. Fld1, Fl2...Attr1 Attr2 etc.
Now I need macro which will count how many of FLd/Attr variables are there and then pass this to the following piece of code as iterations. So instead of having the loop as 1 to 5, I want to pass the iterations to it.
Basically, it does not recognise fld/attr variable as the number is not suffixed.
proc sql ;
select distinct attr, count(*) from mydata.e_joinf;
quit;
data MYDATA.e_final;
set mydata.e_join;
array fld(5);
array attr(5);
do j=1 to 5;
fld_txt = fld(j);
fld_name = attr(j);
msg_txt =tranwrd(msg_txt,trim(fld_name),trim(fld_txt));
msg_txt = compress(msg_txt,'()');
end;
run;
Can someone please help me out?
Thanks!
Message was edited by: sasnewbee