楼主: 一眼瞬间
1214 1

[问答] How to delete exact words in variables. [推广有奖]

  • 0关注
  • 1粉丝

讲师

50%

还不是VIP/贵宾

-

威望
0
论坛币
730 个
通用积分
0.0001
学术水平
0 点
热心指数
4 点
信用等级
0 点
经验
903 点
帖子
376
精华
0
在线时间
309 小时
注册时间
2010-3-14
最后登录
2023-8-19

楼主
一眼瞬间 发表于 2013-10-7 04:30:45 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

Hi friends,


The format of a variable is like this:

54361P(P)~U$


I want to delete (P)~U$ in this variable. i.e., I want “54361P” to be kept.


However, when I use code_new=compress(code,”(P)~U$”), the returned is “54361”.


I wonder, how can I get the outcome like “54361P”?


I think, the problem is that the compress function only compress specific characteristics. What I want to delete is the exact combination of characteristics, i.e., “”(P)~U$”.


Would you help me?


Thank you a lot!


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Variables Variable delete words exact function specific friends problem wonder

沙发
yongyitian 发表于 2013-10-7 05:23:57
  1. data _null_;
  2. a = "54361P(P)~U$"; put a=;
  3. b = tranwrd(a,"(P)~U$", ' ');          put b=;
  4. c = compress(tranwrd(a,"(P)~U$", '')); put c=;
  5. run;
复制代码
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
一眼瞬间 + 1 + 1 + 1 观点有启发

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

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-1 04:21