BookmarkSubscribeRSS Feed
BrahmanandaRao
Lapis Lazuli | Level 10

 

Data Prdsales;
input prdcode $ Jan_sale Feb_sale;
cards;
P101 230 450
P102 340 320
P103 210 250
;
run;

proc sort data=prdsales ;
by prdcode;
run;

data sales_cum;
set prdsales;
by prdcode;
if first.prdcode=1 then cumsale=0;
cumsale+jan_sale;
run;

/*QUESTION1:-How to calculate cumulative sales for each month in the above code
i i want to caluculate jan_sale and f_sale for each month cumulative sales?



1 REPLY 1

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 1 reply
  • 462 views
  • 0 likes
  • 2 in conversation