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
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.