Transposing data set in SAS

sas
transpose

#1

Hi all,

Please help me to transpose Sales data set on Product.

Sales

ID  Product   Sales
1    AAA        50
1    BBB        45
2    AAA        52
2    BBB        46
...

After rearrangement it should be like

Sales_Modified

ID     AAA     BBB
1      50      45  
2      52      46
...

Thx, Steve


#2

@Steve you can use Proc Transpose to perform this. Below is the code.

Proc Transpose Data=Ytd out=test;
by ID;
ID Product;
Run;

Regards,
Sunil


#3

Hi Steve,

Try this -
proc transpose data= out = ;
by ID; /* Variables you want to keep intact /
ID product; /
Variables you want to transpose from rows to columns /
var sales; /
Variable whose value you want to fill in transposed columns */
run;

Hope this helps.

Regards,
Aayush Agrawal