SAS Studio mega-variable to variables

36 Views Asked by At

i need your help with SAS Studio, i got this variable with 200 hundred products and each of them has this ID and this one begins with 001,002,003....200 how can I split this mega-varible to variables for each product

1

There are 1 best solutions below

1
On

Use an array to store the 200 products, iterate over the variable bigvar and scan() off each product, storing into the corresponding array element.

data want ;
  set have ;
  array prd{*} prod1-prod200 ;
  nprod = countw(bigvar,',') ;
  do i = 1 to nprod ;
    prd{i} = scan(bigvar,i,',') ;
  end ;
  drop i nprod ;
run ;