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 | | 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 | | c****y 发帖数: 584 | |
|