全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
4419 3
2012-01-15
悬赏 30 个论坛币 未解决
请问有没有SAS自动宏变量记录SAS代码所在的行数?
num是用来显示代码行数的命令,有没有什么宏变量来记录这个数值?
谢谢
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2012-1-15 05:32:36
very interesting question. if you have the answer, please kindly let me know. that should be a high-level question.

jingju
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-1-15 10:44:40
I don't know the direct way to get the code lines number, but I wish my codes could help.

data test02;
        format text $30000.;
        infile "D:\test.sas" dlm='0a'x;
        input text $ ;
run;
proc sql noprint;
        select count(*) into:code_line_number
        from test02;
quit;
%put &code_line_number.;



And I created the "test.sas" in my D disc, with its detail in the following.
data test01;
        input id ;
cards;
1
2
3
4
5
6
7
8
9
0
;run;

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-1-23 03:40:23
maidenhan 发表于 2012-1-15 10:44
I don't know the direct way to get the code lines number, but I wish my codes could help.

data te ...
谢谢您的回复,您的代码是把另一个SAS代码("test.sas")当作文本读入,然后计算其行数,但是那段代码并不是当前正在运行的代码(使用sql语句的那段)。
我需要的是“当前正运行的代码”中的的行数,也就是需要SAS某自动宏变量能产生,我相信一定有这个功能,但是我不知道如何能用什么方法或者函数返回这个值,也许需要使用SAS底层的命令。

我打个比方,在您的代码中,Sql语句可能是您在一大段代码中的一小段,我如何知道其中“from test02”这段是第几行?
我产生这个问题的用途是为了调试代码的时候使用某种宏命令加在代码中,然后运行程序后就可以在log中使用put显示对应的是SAS里哪行代码。编辑上千行的代码会很方便查找log对应SAS哪行有问题。
谢谢。

继续求助高手。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群