sas输入数据
- 作者: 爱情游戏18644047
- 来源: 51数据库
- 2020-10-02
DATA need;
length state $ 2 score 3 type $ 1;
length string $6;
input string $ @@;
state=substr(string,1,2);
score=compress(string,"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
type=scan(string,-1,"1234567890");
DATALINES;
NY113A NY15B NJ10A NY34A NJ23B
NY87A NY23 NJ23B NJ9A
;
run;
@@意思是连续输入的意思。
例如:data test;
input a b @@;
cards;
1 2 3 4 5 6
;
proc print;
run;
输出结果就是
ods a b
1 1 2
2 3 4
3 5 6
如果不用@@
就是这样:
data test;
input a b;
cards;
1 2
3 4
5 6
;
proc print;
run;
输出结果同样是:
ods a b
1 1 2
2 3 4
3 5 6
length state $ 2 score 3 type $ 1;
length string $6;
input string $ @@;
state=substr(string,1,2);
score=compress(string,"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
type=scan(string,-1,"1234567890");
DATALINES;
NY113A NY15B NJ10A NY34A NJ23B
NY87A NY23 NJ23B NJ9A
;
run;
@@意思是连续输入的意思。
例如:data test;
input a b @@;
cards;
1 2 3 4 5 6
;
proc print;
run;
输出结果就是
ods a b
1 1 2
2 3 4
3 5 6
如果不用@@
就是这样:
data test;
input a b;
cards;
1 2
3 4
5 6
;
proc print;
run;
输出结果同样是:
ods a b
1 1 2
2 3 4
3 5 6
推荐阅读
