全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
3729 7
2010-07-19
如何写程序判断一个数据集里是否有一个固定的变量?
二维码

扫码加我 拉你入群

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

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

全部回复
2010-7-19 16:06:19
进来看看而已
二维码

扫码加我 拉你入群

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

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

2010-7-19 16:19:30
%let vartest=weight;
%let dsid=%sysfunc(open(sashelp.class));

%put %sysfunc(ifc(%sysfunc(varnum(&dsid,&vartest))
                   ,Variable &vartest exists in the dataset!
                   ,Variable &vartest does not exist in the dataset!));
%let rc=%sysfunc(close(&dsid));
二维码

扫码加我 拉你入群

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

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

2010-7-19 16:24:57
3# pobel


高手您能注释一下吗?我是菜鸟有些东西还看不懂,谢谢!
二维码

扫码加我 拉你入群

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

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

2010-7-19 16:31:29
*** Provide the variable you want to check;
%let vartest=weight;

*** Open dataset;
%let dsid=%sysfunc(open(sashelp.class));

*** Get the position of the test variable;
%let varnum=%sysfunc(varnum(&dsid,&vartest));

*** If the position is not 0, then the variable exists in the dataset;
%put The number of the position of variable &vartest: &varnum;

*** Close the dataset;
%let rc=%sysfunc(close(&dsid));
二维码

扫码加我 拉你入群

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

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

2010-7-19 16:31:30
走查询元数据表应该也可以吧
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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