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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.