如何逃脱'sas中的角色

时间:2014-04-16 09:56:37

标签: sas

我想创建一个新变量作为EVENT,条件是:IF WORK =' Active'和条件='计划的便利删除 - 没有maint。 REQ' d&#39。然后事件=' ISH&#39 ;;但如何摆脱' sas中的角色。

SL  WORK    CONDITION
1   Node    part replaced or repaired
2   Active  planned (convenience) removal-maint. req'd.
3   Active  planned convenience removal-no maint. req'd.
4   Active  prop strike
5   Node    planned convenience removal-no maint. req'd.

我尝试了百分比符号并尝试了#39; '双引号,它不起作用。

2 个答案:

答案 0 :(得分:3)

要在字符串中嵌入单引号或双引号,只需连续插入两个,具体取决于字符串所包含的引号类型。

e.g。

/* embed a single quote in single-quoted string */
string = 'My name''s Dave.' ;
/* embed double quotes in double-quoted string */
string = "He said ""Let's go out somewhere.""" ; 

答案 1 :(得分:2)

双引号在这样的语句中掩盖单引号,例如:

IF WORK='Active' AND CONDITION = "planned convenience removal-no maint. req'd." THEN EVENT='ISH ';