楼主: jpj根号2
1600 2

[学习分享] 谷老师的SAS编程演绎input和put变量类型转换,不懂求教 [推广有奖]

  • 0关注
  • 0粉丝

本科生

0%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0
学术水平
1 点
热心指数
1 点
信用等级
0 点
经验
2099 点
帖子
22
精华
0
在线时间
96 小时
注册时间
2018-1-19
最后登录
2020-10-28

相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
如图为谷老师SAS编程演绎关于变量类型转换的语法(图1)以及相关程序(图2和图3)。不懂的是在语法中,input文本转换为数字类型的时候,格式为输入格式,put数字转换为文本时,格式为输出格式,但图2的put所用的格式best.(不为文本的输出格式)和图三的input所用的best.(不为数字的输入格式),望论坛大神指点迷津,小弟不胜感激。
二维码

扫码加我 拉你入群

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

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


微信图片_20180618222729.jpg (2.85 MB)

微信图片_20180618222729.jpg

微信图片_20180618222738.jpg (3.08 MB)

微信图片_20180618222738.jpg

微信图片_20180618222748.jpg (3.53 MB)

微信图片_20180618222748.jpg

回帖推荐

priss111 发表于2楼  查看完整内容

http://support.sas.com/kb/24/590.html new_variable=input(original_variable,informat)中的informat是指new_variable的输入格式(数值型格式); new_variable=put(original_variable,format)中的format是指original_variable的输出格式(数值型格式). ***input(); Convert character to numeric To convert character values to numeric values, use the INPUT function. new_variable = input(original_variable, ...
沙发
priss111 发表于 2018-6-19 16:41:43 |只看作者 |坛友微信交流群
http://support.sas.com/kb/24/590.html
new_variable=input(original_variable,informat)中的informat是指new_variable的输入格式(数值型格式);
new_variable=put(original_variable,format)中的format是指original_variable的输出格式(数值型格式).

***input();
Convert character to numeric

To convert character values to numeric values, use the INPUT function.

new_variable = input(original_variable, informat.);

The informat tells SAS how to interpret the data in the original character variable.

For example, if you have a simple string of digits like 12345678, you can use the basic numeric informat w.d:

data new;
   char_var = '12345678';
   numeric_var = input(char_var, 8.);
run;

***put();
To convert numeric values to character, use the PUT function:

new_variable = put(original_variable, format.);

The format tells SAS what format to apply to the value in the original variable. The format must be of the same type as the original variable. For example, if you are using the PUT function to convert a numeric value to character, the format must be a numeric format.

使用道具

藤椅
jpj根号2 发表于 2018-6-19 22:05:08 |只看作者 |坛友微信交流群
priss111 发表于 2018-6-19 16:41
http://support.sas.com/kb/24/590.html
new_variable=input(original_variable,informat)中的informat是指 ...
大哥,太谢谢您了!!!谢谢,谢谢,谢谢

使用道具

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

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-27 05:32