user3311403
user3311403

Reputation: 867

create SAS dataset with variable number of attributes

I need to create a dataset in SAS, with a variable no of attribute names. Im not so proficient in SAS, so writing the logic in normal lang

for(i=1 to 10)
{
   for (j=1 to n)
   {
      Combinations(j,i);
   }
  //perform some calculations on the temporary average table and delete it
}

The problem is in the combinations function. Here combinations(i,j) { //find all possible combinations //find average of all combinations }

I now need to store all the averages in a temporary table/data set

For ex., for i=2,j=5.. ill have ten combinations for each value of j. so, the column count will be 10 and the row count wil be 2.

This table should be a dynamic dataset I guess. Im not really sure what to do.. just struck.

Any help will be much appreciated.

Thanks

Upvotes: 2

Views: 209

Answers (1)

Joe
Joe

Reputation: 63424

Likely the best solution is to initially create the i,j dataset as vertical - with each eventual-variable as a row - and then use PROC TRANSPOSE to transpose it to horizontal. You can use the ID statement to name the variable.

Upvotes: 1

Related Questions