BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jhh197
Pyrite | Level 9

Hi ,

I have a dataset that has gnp,cnp idnb for each of these we have Cplus and Cccare and each one has 3 p1_lmt and 3 P2_LMT values and out of that i need the first P1_LMT and 1st P2_LMT and need to generate a column Seq as shown below .

 

So i can pick up only seq = 1 for every gnp,cnp,idnb,type combination 

 

gnpcnpidnbTypeP1_LMTP2_LMTAmountSeq
560003200520Cplus00101
560003200520Cplus13202
560003200520Cplus50250303
560003200520Ccare00401
560003200520Ccare13672
560003200520Ccare50250903
3456705674520Cplus125101
3456705674520Cplus25250202
3456705674520Cplus250500303
3456705674520Ccare125401
3456705674520Ccare25250672
3456705674520Ccare250500903

 

Can anyone please help 

1 ACCEPTED SOLUTION

Accepted Solutions
s_lassen
Meteorite | Level 14
data want;
  do seq=1 by 1 until(last.type);
    set have;
    by gnp cnp idnb type;
    output;
    end;
run;

View solution in original post

4 REPLIES 4
jhh197
Pyrite | Level 9

Thank you so much for all your help . Both the solutions work . Just wanted to understand what is the difference between two solutions 

s_lassen
Meteorite | Level 14
data want;
  do seq=1 by 1 until(last.type);
    set have;
    by gnp cnp idnb type;
    output;
    end;
run;
jhh197
Pyrite | Level 9
Thank you so much for all your help . Both solutions are working

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
  • 4 replies
  • 12154 views
  • 9 likes
  • 3 in conversation