SAS 宏在 proc sql into 语句中解析 [英] SAS macro to resolve in proc sql into statement

查看:117
本文介绍了SAS 宏在 proc sql into 语句中解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能帮我解决这里的语法错误.Y 是包含一些值的数据集,比如 1,2,3,4(实际上它包含许多记录)

Can anyone help me with the syntax error here. Y is dataset which contain some value let's say 1,2,3,4 (Actually it contains many records)

/*This is working fine*/
proc sql;
select count(*) into:m from y;
select x into:a1 - :a4 from y;
quit;
%put &m &a1 &a2 &a3 &a4;

/*When i am trying to create a macro which will have a1 to a4 values, it's giving me error. below is my approach*/

proc sql;
select count(*) into:m from y;
select x into:a1 - :a||trim(left(&m.)) from y;
quit;
%put &m &a1 &a2 &a3 &a4;

请有人帮我解决这个问题,向我解释错误的原因.

Please can someone help me with this, explain me the reason for error.

推荐答案

您不再需要说出有多少.SQL 将创建足够多的变量.

You don't need to tell how many anymore. SQL will create just enough variables.

data y;
   do x = 1 to 4;
      output;
      end;
   run;
proc sql;
   select count(*) into:m from y;
   select x into:a1- from y;
   quit;
%put &m &a1 &a2 &a3 &a4;

这至少从 9.3 开始有效.

This is valid at least as of 9.3.

这篇关于SAS 宏在 proc sql into 语句中解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆