How can I rearrange this table using SAS or MS-Access? -
i have dataset on microsoft access , sas of million option prices arranged following fields/columns:
date, company, put/call, price
the put/call
variable indicator variable comes out either put or call each unique date-company combination.
example numbers:
date company put/call price 2001/01/01 xom put 10 2001/01/01 xom call 12 2001/01/01 abb put 11 2001/01/01 abb call 13
what need table arranged with:
date, company, put price, call price
the above example numbers, output should be:
example numbers:
date company put price call price 2001/01/01 xom 10 12 2001/01/01 abb 11 13
would know how use sas, microsoft access or other software complete this?
the following works in access:
select [date], [company], max(iif([put/call]="put", [price], null)) [put price], max(iif([put/call]="call", [price], null)) [call price] [prices] group [date], [company];
note that...
several of column names have spaces or "funny characters" in them, and
date
reserved word in access,
...so square brackets []
important.
Comments
Post a Comment