In SAS, how can I assign the first Rating value with a higher rank in a group to the entire group. See below data set
ID Rating Price Rt_Rank
AN A 105 0
AN B3 200 1
IG A2 705 0
IG A 700 1
IG HY 102 1
IG NR 1005 1
RS HY 20 1
AK NR 803 0
DC A 0 0
DC NR 12000 0
if for a group rt_rank is 1 then I want to assign the first value rating to the entire group.
Desired dataset:
ID Rating Price Rt_Rank Rating_grp
AN B 105 0 B3
AN B3 200 1 B3
IG A2 705 0 A
IG A 700 1 A
IG HY 102 1 A
IG NR 1005 1 A
RS HY 20 1 HY
AK NR 803 0 NR
DC A 0 0 NR
DC NR 12000 0 NR
I achieved this rating_grp by creating a intermediate dataset and creating a temporary variable with this first rating value and then merge it with the original dataset. But I want to know if there is a alternate and easy way to do this.
Thanks in advance!