BookmarkSubscribeRSS Feed
Zhongda
Calcite | Level 5

Hi All,

I am new to sas and I was trying to achieve such thing:

 

here is the dataset:

PERMNO EVTDATE first_event inter_event
10001 8/1/11 1 0
10001 4/2/12 0 1
10002 7/6/98 1 0
10002 10/27/98 0 1
10011 11/13/95 1 0
10011 5/28/96 0 1
10011 5/29/96 0 1
10016 12/9/99 1 0
10016 5/3/00 0 1
10020 4/6/87 1 0
10020 10/21/87 0 1
10020 12/11/87 0 1
10020 4/17/90 1 0
10020 4/24/90 0 1
10028 8/17/99 1 0
10028 3/3/00 0 1
10028 7/14/06 1 0
10028 5/10/07 0 1
I would like to create another column call program and the column will state as:
PERMNO EVTDATE first_event inter_event define a program, and numbers of event in the group
10001 8/1/11 1 0 2
10001 4/2/12 0 1 2
10002 7/6/98 1 0 2
10002 10/27/98 0 1 2
10011 11/13/95 1 0 3
10011 5/28/96 0 1 3
10011 5/29/96 0 1 3
10016 12/9/99 1 0 2
10016 5/3/00 0 1 2
10020 4/6/87 1 0 3
10020 10/21/87 0 1 3
10020 12/11/87 0 1 3
10020 4/17/90 1 0 2
10020 4/24/90 0 1 2
10028 8/17/99 1 0 2
10028 3/3/00 0 1 2
10028 7/14/06 1 0 2
10028 5/10/07 0 1 2
 
let say for permno 10001, there are two obs and they form a program and the program has two event in a row, so it will be definded as 2 for each of the two obs.
 
Thank you so much for your help!
Appreciated,
Zhongda

 

0 Likes
JUST RELEASED

SAS Viya with pay-as-you-go pricing.

Deploy software automatically at the click of a button on the Microsoft Azure Marketplace.

Learn more

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.

Recommended by SAS
These recommendations are generated using AI from SAS. For personalized recommendations, sign in with your SAS profile.
Discussion stats
  • 0 replies
  • 41 views
  • 0 likes
  • 1 in conversation