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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.