/***************************************************************************************************************** SAS file name: Array_Data_FCMP.sas File location: __________________________________________________________________________________________________________________ Purpose: To demonstrate the difference between an array in the data step and an array in PROC FCMP. Author: Peter Clemmensen Creation Date: 17Sep2019 This program supports the blog post "Data Step Array vs. PROC FCMP Array in SAS" on SASnrd.com *****************************************************************************************************************/ /* All array references must have explicit subscript expressions. */ data _null_; array a (i) a1-a3 (1 2 3); i=3; put a=; run; proc fcmp; array a (i) a1-a3 (1 2 3); i=3; put a=; quit; /* PROC FCMP uses parentheses after a name to represent a function call. When you reference an array, use square brackets [ ] or braces { } */ data _null_; array a {3} (1 2 3); b=a(1); put b=; run; proc fcmp; array a {3} (1 2 3); b=a(1); put b=; quit; /* The ARRAY statement in PROC FCMP does not support lower-bound specifications */ data _null_; array a {0:2} (1 2 3); b=a[1]; put b=; run; proc fcmp; array a {0:2} (1 2 3); b=a[1]; put b=; quit; /* You can use a maximum of six dimensions for an array */ data _null_; array a {1, 1, 1, 1, 1, 1, 1}; run; proc fcmp; array a {1, 1, 1, 1, 1, 1, 1}; quit; /* _temporary_ = /Nosymbols */ data _null_; array a {3} _temporary_ (1 2 3); b=a[1]; put b=; run; proc fcmp; array a {3} / nosymbols (1 2 3); b=a[1]; put b=; quit; /* The Size of an FCMP Array is dynamic */ proc fcmp; array a {3} / nosymbols (1 2 3); call dynamic_array(a, 5); a[4]=4; b=a[4]; put b=; quit;