Search code examples
sassas-macro

How can I put a value of a table as the name of another table in SAS Base?


In sas base I have the following table:

Regis   Book    Page

AAA1    book1   127
AAA2    book2   230
BBB1    book1   58
BBB2    book2   300

I have to make a new table that row bookx is the name of the column.

Regis  book1  book2 
AAA1   127
AAA2          230
BBB1   58    
BBB2          300

Thx.


Solution

  • You can use PROC TRANSPOSE for that.

    proc transpose out=want;
       by regis;
       id book;
       var page;
       run;
    

    enter image description here