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!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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