Hi:
If you read the documentation on using arrays, (the section entitled "Array Reference Statement" )
http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000203460.htm
You will find that array references are of the form: [pre]array-name(subscript)[/pre]
Also, a usage note. There is a HUGE warning in the documentation about the use of POKELONG, which I quote here in its entirety:
"CAUTION:
The CALL POKELONG routine is intended only for experienced programmers in specific cases. If you plan to use this routine, use extreme care both in your programming and in your typing. Writing directly into memory can cause devastating problems. It bypasses the normal safeguards that prevent you from destroying a vital element in your SAS session or in another piece of software that is active at the time."
My overall recommendation is that you read the documentation on ARRAY processing and on using FIRST. and LAST. by variable processing as well as some Macro processing basics. One possible alternate approach is shown below.
cynthia
[pre]
data xyz;
infile datalines;
input pk _name_ $;
return;
datalines;
100 kermit
100 bigbird
100 oscar
100 elmo
200 gonzo
200 ernie
300 gonzo
300 count
400 kermit
400 rowlf
500 elmo
500 oscar
500 bert
500 cookie
;
run;
proc sql noprint;
select distinct _name_ into :columns separated by ' '
from xyz;
quit;
data abc_new(drop=i _name_);
set xyz;
by pk;
array cols{*} $3 &columns;
retain numfound 0 &columns;
** reinitialize array to 'No' for first of group;
if first.pk then do;
do i = 1 to dim(cols) by 1;
cols(i) = 'No';
end;
numfound = 0;
end;
** check every obs against list of var names in array;
do i=1 to dim(cols);
if _name_ = vname(cols(i)) then do;
cols(i) = 'Yes';
numfound + 1;
end;
end;
** if last of group, then output;
if last.pk then output;
run;
proc print data=abc_new;
title 'With regular array processing';
run;
[/pre]