BLANKSTR Function

BLANKSTR (n) ;

The BLANKSTR function returns a blank character string of a specified length. You can use the BLANKSTR function in conjunction with the J function to allocate character arrays, as follows:

/* combine colors and objects */
color  = {"Red" "Green" "Blue"};            /* nleng(color) =5 */
object = {"Balloon" "Leaf" "Marble"};       /* nleng(object)=7 */

/* compute maximum length of a color/object combination */
len = nleng(color) + nleng(object) + 1;
items = j(3, 3, BlankStr(len));             /* allocate char vector */
do i = 1 to ncol(color);
   do j = 1 to ncol(object);
      items[i,j] = color[i] + " " + object[j]; /* concatenate strings */
   end;
end;
print items;

Figure 24.55: Filling an Allocated Character Matrix

items
Red Balloon Red Leaf Red Marble
Green Balloon Green Leaf Green Marble
Blue Balloon Blue Leaf Blue Marble