Hi:
The CAT function concatenates text strings or text variable values without removing leading or trailing blanks.
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002257060.htm
For more information on the use of the &MACVAR reference (in your code, &NUMATT), this paper provides a good introduction:
http://www2.sas.com/proceedings/sugi28/056-28.pdf
Without knowing how &NUMATT is being created (%LET or CALL SYMPUT) or what the whole rest of the program is doing, it looks like &NUMATT is going to supply a value for the LENGTH and the other statements. For example, if &NUMATT is 4, then the compiler would receive this "resolved" code:
[pre]
DATA kernel;
LENGTH scorepattern $10 attpattern $4;
SET kernel;
scorepattern = CAT(OF item scoreatt1-scoreatt4);
attpattern = CAT(OF scoreatt1-scoreatt4);
RUN;
[/pre]
and if the macro variable &NUMATT had been assigned a value of 6, then this would be the "resolved" code that was sent to the compiler:
[pre]
DATA kernel;
LENGTH scorepattern $10 attpattern $6;
SET kernel;
scorepattern = CAT(OF item scoreatt1-scoreatt6);
attpattern = CAT(OF scoreatt1-scoreatt6);
RUN;
[/pre]
You are dealing with the WORK.KERNEL data -- how does it get created?? If you do a PROC CONTENTS on WORK.KERNEL, how do the SCOREATT1-SCOREATTn variables get created??? How many numbered variables are there? Can the number of "SCOREATT" variables change and if so, based on what condition??
cynthia