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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

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