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

sas-innovate-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

Plus, pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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