通过行观察中的字符串选择SAS列 [英] Selecting SAS column by the character string within a row observation

查看:37
本文介绍了通过行观察中的字符串选择SAS列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表(A),其中的行具有与列名匹配的字符串.我正在尝试将行观察中的名称与表 A 的相应列进行匹配,并检查该列中的值并给出 T/F 标志.

I have a table(A) with rows that have character strings that should match column names. I'm trying to match the name within the row observation with the corresponding column of the table A and check the values within that column and give a T/F flag.

例如,如果行观察是A-3",我可以进入A-3"列并检查相应行的值.

for example if the row observation is 'A-3', i can go into the 'A-3' column and check that corresponding row for a value.

推荐答案

使用 VVALUEX() 只要你对一切都恢复为字符没问题.

Use VVALUEX() as long as you're ok with everything coming back as characters. Link to VVALUEX documentation

A-3 不是有效的 SAS 变量名称,但假设您将其称为A-3"n.

A-3 isn't a valid SAS variable name, but assuming it is you'd refer to it as 'A-3'n.

   data want;
      set have;
      x = vvaluex('A-3'n);
      x1 = vvaluex(A_3);    
   run;

这篇关于通过行观察中的字符串选择SAS列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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