首页 \ 问答 \ 修改SAS中宏变量的值(Modifying the value of macro variable in SAS)

修改SAS中宏变量的值(Modifying the value of macro variable in SAS)

我使用%let选项在我的sas代码中创建了两个宏变量。

data sasdata1.dataone;
set sasdata1.dataone ;
%let week=1;
%let sum=0;
do i=1 to 53;
%let sum= _W&week._NRX + &sum.;
week=&week+1;
end;
drop i;
week=&week;
sum=&sum.;
run;

即使在循环执行后,周变量的值仍为1。 哪个是更改宏变量值的正确方法?


I created two macro variables in my sas code using the %let option.

data sasdata1.dataone;
set sasdata1.dataone ;
%let week=1;
%let sum=0;
do i=1 to 53;
%let sum= _W&week._NRX + &sum.;
week=&week+1;
end;
drop i;
week=&week;
sum=&sum.;
run;

the value of the week variable remains 1 even after the loop has executed. Which is the correct way to change the value of Macro variables?


原文:https://stackoverflow.com/questions/17651481
更新时间:2021-09-25 20:09

最满意答案

我们仍然使用CanJS 2.0.7,我们使用can.view.mustache()预编译模板

请参阅: https//github.com/reciprocity/ggrc-core/blob/develop/src/ggrc/assets/javascripts/application.js#L1490


We're still on CanJS 2.0.7, and we precompile our templates using can.view.mustache()

See: https://github.com/reciprocity/ggrc-core/blob/develop/src/ggrc/assets/javascripts/application.js#L1490

相关问答

更多
  • 我发布了https://github.com/wycats/handlebars.js/issues/452 ,这实际上是https://github.com/wycats/handlebars.js/issues/428的欺骗。 问题已得到解决,很快就会在npm发布。 I posted https://github.com/wycats/handlebars.js/issues/452, which was actually a dupe of https://github.com/wycats/hand ...
  • 这在文档中并不明显,但是仔细观察实现 ,我发现可以通过传入一个空的--root参数来切换模板路径/名称。 默认情况下,脚本调用basename() ,它编译为my_template : handlebars app/templates/my_template.hbs -e hbs 传入一个空的--root参数将避免转换路径,因此以下命令将编译为app/templates/my_template : handlebars app/templates/my_template.hbs -e hbs -r T ...
  • 我们仍然使用CanJS 2.0.7,我们使用can.view.mustache()预编译模板 请参阅: https : //github.com/reciprocity/ggrc-core/blob/develop/src/ggrc/assets/javascripts/application.js#L1490 We're still on CanJS 2.0.7, and we precompile our templates using can.view.mustache() See: https:// ...
  • 事实证明,这是因为Visual Studio会将我的.hbs文件保存在带有BOM(带签名)的UTF8中,这会在文件的开头添加一堆隐藏的字符。 我没有签名就保存了它们,现在它完美无缺。 没有更多的空字符串,我的布局是我期望的。 Turns out it was because Visual Studio would save my .hbs files in UTF8 with BOM (with signature) which adds a bunch of hidden characters to th ...
  • 我们不能做自定义分隔符(Handlebars的缺点),但有几个解决方案可能适合您。 这两者都不一定是惯用的,所以你要判断这些对你正在进行的项目来说是多么合适。 字符串替换 你可以使用一些自定义(临时)分隔符来处理内容中不应该被编译的模板,然后创建一个块帮助程序,在编译期间将这些分隔符转换回有效的句柄表达式(我测试了这个答案并且它可以工作): 例如: Handlebars.registerHelper("raw", function(options) { return options.fn(this).r ...
  • 如果您想要多个文件,请像这样在命令中列出它们 handlebars file1 file2 file3 -f outfile 您希望为您的生产站点存储预编译的文件,因为它大大缩短了加载时间。 If you want multiple files, list them in the command like so handlebars file1 file2 file3 -f outfile You DO want to store precompiled files for your productio ...
  • 以下是我在复杂的CanJS应用程序中设置路由的方法。 你可以在这里看到一个例子。 首先,不要使用can.Control路由。 这是一个反模式,将在3.0中删除,就像本期中的想法一样。 而是设置一个routing app模块,按照惯例导入和设置模块,类似于此处使用的模块。 我将在稍后解释如何设置routing app模块。 但首先,了解can.route如何与您习惯于考虑路由的方式不同,这一点很重要。 它的不同之处在于它一开始很难理解,但一旦你得到它; 您希望看到它对于客户端路由有多么强大和完美。 想想can ...
  • 所以这很复杂,但是由于咕噜咕噜的魔力,我得到了它。 我设置了grunt来使用grunt-contrib-jade和grunt-contrib-handlebars,它会将我的jade包含页面自动编译为HBS,然后将这些HBS文件编译为JS。 jade: { compile: { options: { pretty: true }, files: [ { cwd: "views/templates", src: "**/*.jade", ...
  • 在示例HTML中,需要更新通过脚本标记包含的Handlebars库。 当它引用运行时,你需要更新你明确包含的JS库,而不是NPM包 (通常)。 实际上应该包含版本4.0.0+的版本。 例如