由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - Help needed for a SAS question
相关主题
two SAS macro questions#SAS BASE 问题,明天就考试了##
SAS questionWHICH ONE IS CORRECT?
Re: 请问神经网络如何用SAS实现?SAS base string question
[合集] a small question on SAS data importquestion about SAS BASE 123 No.64?
关于SAS里TRUNCOVER一问SAS菜鸟请教substr
What is the python trick to perform same task as COMPBL function in SAS?问个SAS 问题
blank lines /sas/data stepName list of certified SAS programer
[SAS] using put with missing values请问如何改变 data set's column 位置. 比如name, id 换成id, name.
相关话题的讨论汇总
话题: oxycodone话题: sas话题: name话题: var
进入Statistics版参与讨论
1 (共1页)
c****y
发帖数: 584
1
I have a field contains drug names like this:
OXYCODONE-ACETAMINOPHEN 5-325
OXYCODONE-ACETAMINOPHEN 7.5-32
ROXICET 5-325 MG
ACETAMINOPHEN-CODEINE #3 300-3
...
I want it to look like this:
OXYCODONE-ACETAMINOPHEN
OXYCODONE-ACETAMINOPHEN
ROXICET
ACETAMINOPHEN-CODEINE
...
How can I do this in SAS? Many thanks!!!
s******8
发帖数: 29
2
scan(var_name,1)
不行的话试试scan(var_name," ",1)
c****y
发帖数: 584
3
Scan(var_name, 1) give me the first word of the drug's name only.
Scan(Var_name,'',1) give me blanks.
More help needed!
l****u
发帖数: 529
4
scan(var_name,1,' ');
c****y
发帖数: 584
5
it still give me the first word only. Some of the drugs names have two words
in it.
s*y
发帖数: 18644
6
第一个空格前的? 有个index() function
c****y
发帖数: 584
7
No, there might be more than 1 space because there might be more than one
word in the name such as this
OXYCODONE HCL 15 MG
I want OXYCODONE HCL.
Help!
s******8
发帖数: 29
8
看不太懂数据的格式,第二位到底是啥?剂量?有dictionary没?
if anyalpha(substr(scan(var_name,2),1,1))=0 then new_var_name=scan(var_name,
1);
else new_var_name=cat(scan(var_name),1)," ",scan(var_name),2);
思路是检验第二段首字符是否为字母,如果不是就只截取第一段;是的话就截第一段和
第二段
l****u
发帖数: 529
9
scan(var_name,1,'0123456789#')
c****y
发帖数: 584
10
Thanks, that works!
c****y
发帖数: 584
11
Thanks, that works!
1 (共1页)
进入Statistics版参与讨论
相关主题
请问如何改变 data set's column 位置. 比如name, id 换成id, name.关于SAS里TRUNCOVER一问
菜鸟的SAS问题,向高手求助What is the python trick to perform same task as COMPBL function in SAS?
[合集] 求助,怎样在SAS里读数据的column name?blank lines /sas/data step
[合集] SAS 问题:如何在使用macro的时候保护data。[SAS] using put with missing values
two SAS macro questions#SAS BASE 问题,明天就考试了##
SAS questionWHICH ONE IS CORRECT?
Re: 请问神经网络如何用SAS实现?SAS base string question
[合集] a small question on SAS data importquestion about SAS BASE 123 No.64?
相关话题的讨论汇总
话题: oxycodone话题: sas话题: name话题: var