Hi
I need to substitute blank values in column "January Estimate" with the value from "6m Avg" every time On Promotion is "N" and January estimate is "." But for On Promotion "Y" it should retain the same value in the estimate column
ProdCode | LongDescription | QtyOnHand | On Promotion | January Estimate | 6m Avg |
1111 | XXX | 54 | Y | 72 | 18 |
222 | YYY | 33 | N | . | 16 |
354656 | ZZZ | 52 | Y | 61 | 16 |
How do I do it?
Thanks
You need to show example data that captures both conditions and, for clarity, what you want the resulting file to look like. I, personally, would also like to see you propose code to solve the problem.
Hi, please try the below code , However i agree with Art , if you provide more details then you will get the more appropriate response.
i just tried with a simple if then statement. Hope this helps.
data want;
set have;
if OnPromotion='N' and JanuaryEstimate eq . then JanuaryEstimate=_6mAvg;
run;
Thanks,
Jag
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.