You need to enable JavaScript to run this app. SAS基于随机变量的双表关联蒙特卡洛模拟代码问题咨询
优惠活动
大模型
产品
解决方案
定价
更多

SAS基于随机变量的双表关联蒙特卡洛模拟代码问题咨询

enter image description here

enter image description here

  • Table1包含Col1与Col2两个字段
  • Table2为Table1中Col1去重后构建的数据集,去重得到的字段命名为Col3,需为Table2生成随机变量Col4
  • 需实现模拟计算逻辑:计算函数Col2*2 + Col4,其中Col4的匹配规则为Table1.Col1 = Table2.Col3
  • 要求每次试验生成的Col4取值互不相同
  • 暂不熟悉该场景的实现方法,已尝试编写对应代码,希望获得专业指导

尝试编写的代码如下:

data monte_carlo;
%let num = 10;
do i = 1 to #
    do while(not eof);
        set Table2 end=eof;
        Col4 = rand('uniform'); 
        put Col4;
    end;
    do while(not eof);
        set Table1 end=eof;
        Col2*2 + Col4;
    end;
end;
run;

内容的提问来源于stack exchange,提问作者user13812765

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.11.01 06:36:05