Hi There.
I have this data, data A & B
I want to ask your expertise how to divide value from total_balance (Data A) to every var cell in data B for each year to get the percentage, so it will show like the picture below.
I usually do this manually on excel and I want to improve this.
here is my code
generate Data A
proc tabulate data = data_a;
table year, total_balance;
var total_balance;
class year;
run;
generate Data B
proc tabulate data = lnsx3by;
table year, MOBx*balance;
var balance;
class year MOBx;
run;
Thank you for your help
Since you only posted pictures we have to make a lot of guesses at what data you actually have.
It sounds to me like you one dataset with two variables YEAR and TOTAL_BALANCE.
And a second dataset with YEAR, MOBX and BALANCE.
So it sounds like you just want to MERGE the two by YEAR and then DIVIDE the two numbers to make a percentage.
data want;
merge b a ;
by year ;
percent = balance/total_balance.
format percent percent6. ;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.