SAS中文论坛

标题: ask for help for prxchange('S/(\()|(\))//',-1,var1) [打印本页]

作者: shiyiming    时间: 2011-9-28 07:38
标题: ask for help for prxchange('S/(\()|(\))//',-1,var1)
I am learning PRX and found it is not easy as expected, and hope someone can help.
e.g.:
prxchange('S/(\()|(\))//',-1,var1)        (var1: a char variable in the dataset)
in this expression,
(\(): does this mean match with missing value?
|: does this mean 'or' ?
(\): have no idea at all
//: does this mean change to missing vlue?

thanks a lot if someone explain this to me.
作者: shiyiming    时间: 2011-9-28 11:28
标题: Re: ask for help for prxchange('S/(\()|(\))//',-1,var1)
我只了解一点正则表达式,我的理解是
\ 是转义字符 比如\( 表示的就是(,因为单独使用(会被当成其他字符。比如\ / ?等都需要\来表达

/(\()|(\))/ = (|) 也就是匹配左右括号的表达式

"S/(\()|(\))//" = 就是把var1中的括号去掉,你换成这个,估计就可以理解了:"S/(\()|(\))/-/"

我也是前不久正弄了个相关的用到的,希望对你有用
作者: shiyiming    时间: 2011-9-28 23:06
标题: Re: ask for help for prxchange('S/(\()|(\))//',-1,var1)
thanks a lot.




欢迎光临 SAS中文论坛 (http://mysas.net/forum/) Powered by Discuz! X3.2