BookmarkSubscribeRSS Feed
LOK
Calcite | Level 5 LOK
Calcite | Level 5
Hi,

Base dataset

month a/cno amount
jan 1001 100
jan 1001 200
jan 1001 100
jan 1001 100
jan 1001 200
jan 1001 500
jan 1002 500
jan 1002 500


i require output dataset like this

month a/cno amount count
jan 1001 100 1
jan 1001 100 2
jan 1001 100 3
jan 1001 200 1
jan 1001 200 2
jan 1001 500 1
jan 1002 500 1
jan 1002 500 2

Require count for repetitive amount...by month and a/c no
provide me the code... Message was edited by: NIKKI
2 REPLIES 2
deleted_user
Not applicable
Hi Nikki,


plz try the following code.


data sample;
input month $ acno amount;
datalines;
jan 1001 100
jan 1001 200
jan 1001 100
jan 1001 100
jan 1001 200
jan 1001 500
jan 1002 500
jan 1002 500
;
proc sort data=sample;
by month acno amount;
run;
data sample1;
set sample;
retain cnt;
by month acno amount;
if first.amount then cnt=1;
else cnt+1;
run;

Thanks
Slone
LOK
Calcite | Level 5 LOK
Calcite | Level 5
Hi, Slone
Thankyou!
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1225 views
  • 0 likes
  • 2 in conversation