Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在选项卡文件中有一个带逗号的数据,并且我已经将其导入到 sas 中,作为带有逗号值的 char 数据类型。像 23,1 53,2
我现在想用其中一个将它们转换为数字。或逗号我该怎么做?如果我使用
want=input(have,comma.); informat want comma.; format want comma.;
我得到缺失值。,!
您可以使用该NUMXw.d信息输入以逗号作为小数分隔符的数字。
NUMXw.d
want = input(have,NUM4.1);
或者只是在初始输入语句中使用它,您不必转换它。
NUMXw.d同样是一种格式,因此如果您更愿意查看小数,您可以使用它来用逗号显示变量。
您可以使用 TRANWRD 函数将逗号替换为句点,然后将其包装在 INPUT 函数中以将新字符值转换为数字。
F2 = INPUT(TRANWRD(F1,',','.'),4.1);