BookmarkSubscribeRSS Feed
manojdawson
Calcite | Level 5

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

ProdCodeLongDescriptionQtyOnHandOn PromotionJanuary Estimate6m Avg
1111XXX54Y7218
222YYY33N.16
354656ZZZ52Y6116

How do I do it?

Thanks

2 REPLIES 2
art297
Opal | Level 21

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.

Jagadishkatam
Amethyst | Level 16

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

Thanks,
Jag

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1552 views
  • 0 likes
  • 3 in conversation