如何在 SAS 中的 cats() 字符串连接中编写条件
How to write a condition inside a cats() string-concatenation in SAS
是否可以在 cats() 函数中编写条件?
像这样:
data ...
...
line2=cats('xxxx',if (severity=.) then 'missing' else severity,'yyyyy');
...
我想这样做是为了编写一个 json 文件。
因为严重性是一个数字变量,所以当它丢失时它是一个 .
并且会创建无效的 json 文件。
我正在寻找一种方法来用 json 中的字符串替换这些点,例如 例如 'missing' 在我的示例中。
编辑:忘了说我在数据步骤中
为什么不直接使用 IFC()
函数?
ifc(severity=.,'missing',put(severity,best12.))
定义格式。
proc format ;
value severity .='missing' other=[best12.];
run;
...
line2=cats('xxxx',put(severity,severity.),'yyyyy')
是否可以在 cats() 函数中编写条件?
像这样:
data ...
...
line2=cats('xxxx',if (severity=.) then 'missing' else severity,'yyyyy');
...
我想这样做是为了编写一个 json 文件。
因为严重性是一个数字变量,所以当它丢失时它是一个 .
并且会创建无效的 json 文件。
我正在寻找一种方法来用 json 中的字符串替换这些点,例如 例如 'missing' 在我的示例中。
编辑:忘了说我在数据步骤中
为什么不直接使用 IFC()
函数?
ifc(severity=.,'missing',put(severity,best12.))
定义格式。
proc format ;
value severity .='missing' other=[best12.];
run;
...
line2=cats('xxxx',put(severity,severity.),'yyyyy')