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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.