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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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