Help using Base SAS procedures

Getting a single row of data from several

Reply
Contributor spg
Contributor
Posts: 61

Getting a single row of data from several

Say I have the following dataset:
ID ASSET ORIGIN
1 100 1
1 100 8
1 200 1
1 200 8
1 302 2
2 100 1
2 100 8
2 200 1
2 200 8
2 302 2


where ASSET= 100 is Equity, 200 is Fixed Incomes,
and ORIGIN= 1 is domestic, 2 is foreign and 8 is global

I want to create a portfolio snapshot for each ID (variable values= 1 or 0) so that the final dataset looks as below:

ID EQUITY DOMEQUITY FOREQUITY GLOEQUITY FIXED DOMFIXED FORFIXED GLOFIXED
1 1 1 0 1 1 1 0 1
2 1 1 0 1 1 1 0 0


Though I have shown an identical portfolio for the two IDs, it is generally different for different individuals. I have about 23 asset classes and over 72,000 observations. Another thing is that the IDs are not continuous numbers. So I have IDs that go 1,2,6,14 etc.

Any suggestions? I have been struggling with this.
Super Contributor
Super Contributor
Posts: 3,174

Re: Getting a single row of data from several

SAS PROC TRANSPOSE can address this data transposing (vertical to horizontal) requirement. Have a look at the SAS documentation and also there are technical/conference papers on the topic at the SAS support http://support.sas.com/ website.

Scott Barry
SBBWorks, Inc.
Contributor spg
Contributor
Posts: 61

Re: Getting a single row of data from several

Thanks Scott! I'll try what you suggested.
Ask a Question
Discussion stats
  • 2 replies
  • 87 views
  • 0 likes
  • 2 in conversation