I'm assuming that this is a problem using IN in PROC FCMP. The following is the log. 184 proc fcmp OUTLIB=GACLUSTR.FUNCTIONS.GACLUSTER; 185 186 function runConnectivity2(cl ,near[*,*],num_near); WARNING: Function runConnectivity2 is already defined in packet GACLUSTER. Function runConnectivity2 as defined in the current program will be used as default when packet is not specified. 187 label='Runs Connectivity to find the connectedness measure for cluster cl.'; 188 * cl is the indexes of the cluster in ascending order, near is the matrix of 189 the nearest neighbors, one row for each unit in the population, num_near 190 is the number of nearest neighbors that contribute to measure. The units in a 191 row are in ascending order of nearness. num_near must be less than or equal 192 to the second dimension of near. Returns -1 if num_near is greater than 193 the second dimension of near.; 194 195 196 if num_near > dim2(near) then return(-1); 197 s=0; 198 do i = 1 to dim(cl); 199 ii=cl; 200 put near=; 201 do j=1 to num_near; 202 if ~(near[ii, j] in cl) then s=s+1/j; -- 22 76 ERROR 22-322: Syntax error, expecting one of the following: (, :. ERROR 76-322: Syntax error, statement will be ignored. 203 end; 204 end; 205 return(s); 206 endsub; 207 208 run; NOTE: Execution aborted because of errors in program. Reenter the corrected program or enter "QUIT;" to exit procedure. 209 210 211 quit; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE FCMP used (Total process time): real time 0.84 seconds cpu time 0.12 seconds 212 213 options cmplib=GACLUSTR.FUNCTIONS; 214 data _null_; 215 array c{6} _TEMPORARY_ (1 3 4 7 9 11); 216 k=6; 217 /*array c{3} _TEMPORARY_ (9 10 11); 218 k=3;*/ 219 array a{17,10} _TEMPORARY_ 220 (2 3 4 7 5 6 8 9 10 11 221 4 3 5 1 6 7 8 9 10 11 222 2 1 7 4 6 5 8 9 10 11 223 5 2 6 7 3 1 8 9 10 11 224 4 6 2 7 8 3 1 9 10 11 225 5 7 4 2 8 3 1 9 10 11 226 6 3 4 2 5 8 1 9 10 11 227 12 9 13 14 6 7 5 15 4 2 228 13 14 8 15 7 6 5 16 3 10 229 11 16 17 9 15 14 13 12 8 7 230 10 17 16 13 14 9 12 15 8 7 231 13 14 9 8 15 6 16 5 7 4 232 14 12 9 15 8 16 7 6 5 10 233 13 12 9 15 8 16 7 6 5 10 234 14 13 12 9 8 16 10 7 6 5 235 17 10 15 11 14 13 9 12 6 7 236 16 10 11 15 14 13 12 9 8 6); 237 238 239 nm=5; 240 s=0; 241 do i = 1 to dim(c); 242 ii=c; 243 *put 'before ' i= ii= s=; 244 do j=1 to nm; 245 if ~(a[ii,j] IN c) then s=s+1/j; 246 end; 247 *put 'after ' i= ii= s=; 248 end; 249 put s=; 250 251 *sum=runConnectivity2(c,a,nm); 252 *put sum=; 253 *if sum=-1 then put 'num_near ' nm 'is greater than second dimension of a ' d2_a; 254 255 run; s=10.05 NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds The log shows a snippet of the code that works in a data step but I get a syntax error when it is being defined as a function in FCMP. I've tried all manner combinations such as putting ( ) around cl, using cl , using 'of cl', putting the array into the function definition and appropriately changing the names so that the variable references are correct and not conflicted.
... View more