楼主: dxystata
1084 4

如果变量没有变量标签,如何得到空呢? [推广有奖]

版主

已卖:302份资源

大师

37%

还不是VIP/贵宾

-

TA的文库  其他...

Software

中英文Ebook

R学习

威望
2
论坛币
183395 个
通用积分
15333.1475
学术水平
208 点
热心指数
271 点
信用等级
174 点
经验
298627 点
帖子
5586
精华
1
在线时间
13632 小时
注册时间
2006-6-21
最后登录
2025-12-22

初级学术勋章 初级热心勋章 中级热心勋章 初级信用勋章

楼主
dxystata 发表于 2015-2-25 16:23:17 |AI写论文
20论坛币
data aaa;
label x="xx";
input x y;
cards;
1 2
1 2
;
run;

data _null_;
        if 0 then set aaa;
        call symput ('label1', Vlabel(x));
        call symput ('label2', Vlabel(y));
run;

%put &label1;
%put &label2;

y变量标签为空,但label2解析出来为y,如何得到label2为空呢?谢谢!

关键词:symput label cards Input Abel null 标签 如何

沙发
jingju11 发表于 2015-2-26 09:53:50
Instead of using vlabel() function, you can use the output dataset from proc contents. JingJu

藤椅
novice505 发表于 2015-2-26 12:49:59
Or get information from sashelp.vcolumn:
proc sql noprint;
   select label into :label1 from sashelp.vcolumn where libname='WORK' & memname='AAA' & upcase(name)='X';
   select label into :label2 from sashelp.vcolumn where libname='WORK' & memname='AAA' & upcase(name)='Y';
quit;

板凳
wpfwxn 发表于 2015-2-28 10:03:55
Please try the following code:

%let dsid=%sysfunc(open(aaa,i));
%let label1 = %sysfunc(varlabel(&dsid.,1));
%let label2 = %sysfunc(varlabel(&dsid.,2));

%put +++&label1++;
%put +++&label2++;
已有 1 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
jingju11 + 5 + 5 + 5 + 5 精彩帖子

总评分: 论坛币 + 5  学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

报纸
jingju11 发表于 2015-3-3 12:00:58
wpfwxn 发表于 2015-2-28 10:03
Please try the following code:

%let dsid=%sysfunc(open(aaa,i));
thanks. Good point. 京剧

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-29 15:02