******************************************* * DISCRETE RANDOM VARIABLE SIMULATION * * * * DSN= DSIM1.SAS * *******************************************; data dsim1; supply = 36; seed1=45 ; seed2 = 45; do i=1 to 10000; demand = 0; edemand = 0; esupply = 0; x1=int(ranuni(seed1)*100); if x1 le 29 then dtype = 'high'; if x1 ge 30 and x1 le 74 then dtype = 'avg'; if x1 ge 75 then dtype = 'low'; x2=int(ranuni(seed2)*100); if dtype = 'high' and x2 le 4 then demand = 36; if dtype = 'high' and x2 ge 5 and x2 le 14 then demand = 48; if dtype = 'high' and x2 ge 15 and x2 le 39 then demand = 60; if dtype = 'high' and x2 ge 40 and x2 le 69 then demand = 72; if dtype = 'high' and x2 ge 70 and x2 le 89 then demand = 84; if dtype = 'high' and x2 ge 90 and x2 le 99 then demand = 96; if dtype = 'avg' and x2 le 9 then demand = 36; if dtype = 'avg' and x2 ge 10 and x2 le 29 then demand = 48; if dtype = 'avg' and x2 ge 30 and x2 le 59 then demand = 60; if dtype = 'avg' and x2 ge 60 and x2 le 84 then demand = 72; if dtype = 'avg' and x2 ge 85 and x2 le 94 then demand = 84; if dtype = 'avg' and x2 ge 95 and x2 le 99 then demand = 96; if dtype = 'low' and x2 le 14 then demand = 36; if dtype = 'low' and x2 ge 15 and x2 le 39 then demand = 48; if dtype = 'low' and x2 ge 40 and x2 le 74 then demand = 60; if dtype = 'low' and x2 ge 75 and x2 le 89 then demand = 72; if dtype = 'low' and x2 ge 90 and x2 le 94 then demand = 84; if dtype = 'low' and x2 ge 95 and x2 le 99 then demand = 96; if supply > demand then esupply = supply - demand; if demand > supply then edemand = demand - supply; sales = supply - esupply; revenue = (0.40*sales) ; salrev = (0.10*esupply) ; cost = (0.25*supply) ; lostpr = (0.15*edemand); profit = (0.40*sales) + (0.10*esupply) - (0.25*supply) - (0.15*edemand); output; end; proc print; id i; var seed1 x1 dtype seed2 x2 demand supply sales edemand esupply profit; proc means; var demand supply sales edemand esupply revenue lostpr cost salrev profit; title 'POLICY A SUPPLY = 36'; run;