BookmarkSubscribeRSS Feed
spg
Obsidian | Level 7 spg
Obsidian | Level 7
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.
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
spg
Obsidian | Level 7 spg
Obsidian | Level 7
Thanks Scott! I'll try what you suggested.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 538 views
  • 0 likes
  • 2 in conversation