I'm trying to do some calculations with a data set like the one below:
Item_Set_1 Item_Set_2 Value Calculation
xyz 1
aaa 2
bbb 3
ccc 4
ddd 5
eee 6
I want to do it so that I take the corresponding value to Item_Set_1 and multiply by the corresponding value to Item_Set_2. Any easy way to do this?
data want;
set have;
retain prev_value;
prev_value = lag(value);
if _N_ > 1 then calculation = value * prev_value;
run;
I see no matching values in the item_set variables. Please explain what you mean by "corresponding".
Apologies for that. See the example below for something a bit more accurate.
Time Item_Set_1 Item_Set_2 Value Calculation
period1 xyz 1
period2 aaa 2
period3 bbb 3
period4 ccc 4
period5 ddd 5
period6 eee 6
Writing detailed requirement with examples will help people trying to understand the problems you are facing and help you out.
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!
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.
Ready to level-up your skills? Choose your own adventure.