I need to fill the nulls of a column with the mean sum of the division of two columns multiplied by one column and rest the previous An example would be
A B_01 B_02 ... B_60
5 . .
5 2 3
7 3 1,2
9 3 0,3
4 . .
Well, I would like the missing value for column B_01 to be (2/5 + 3/7 + 3/9) / 3 * its corresponding column A For column B_02(3/5 + 1,2/7 + 0,3/9)/3 * its corresponding column A - his new value in B_01
I have thought about doing this, but it turns out that I have 60 columns with which to do it and the only way it comes to mi mind is to do this 60 times.
thanks
Proc sql;
create table new as
Select *
, sum(B_01/A)/sum(case when B_01 is missimg then . else 1)*A end as new_B_01
, sum(B_02/A)/sum(case when B_02 is missimg then . else 1)*A-B_01 end as new_B_02
from table_one
;
I provided a possible answer in your other thread. Please do not post the same question more than once.
ALL REPLIES should be posted at https://communities.sas.com/t5/SAS-Programming/fill-the-nulls-of-a-column-with-the-mean-sum-of-the-d...
Sorry but I have changed the question. Should I delete the old question?
The code I gave in my other thread should be easily modified to handle this change. Please look at the code in my other thread, then try it and finally see if you can modify it to make it handle this change.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.