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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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