BookmarkSubscribeRSS Feed
LanMin
Fluorite | Level 6

Hello,
Below is a small sample of a large data set.

Firmid year segmentID segmentsales siccode
1001 1999 1 20 4100
1001 1999 2 10 4200
1001 2000 1 15 4100
1001 2000 2 12 4200
1001 2000 3 13 5100
1002 1999 1 20 4100
1002 1999 2 13 9100
1002 2001 1 20 2867
1002 2001 2 13 3200
1002 2000 3 20 7100

1. First, I can compute how many unique siccode my data has, in this small example above, I have 7 unique siccode
2. my vector will have 7 elements, each element correspond to the segmentsales, for each firm-year, there are non-zero segmentsales and zero segmentsales  (when the firm does not have such a segment), e.g. firmid=1001, year=1999, my vector =[20,10,0,0,0,0,0], firmid=1001, year=2000, my vector =[15,12,13,0,0,0]

How should I program this?

Thanks!

Lan

2 REPLIES 2
Reeza
Super User

Are you programming in IML or BASE? If IML you may want to repost this in the IML forum.

LanMin
Fluorite | Level 6

I do not know how to program in IML.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 912 views
  • 0 likes
  • 2 in conversation