楼主: benny10
3915 6

sas合并问题 [推广有奖]

  • 0关注
  • 0粉丝

硕士生

4%

还不是VIP/贵宾

-

威望
0
论坛币
114 个
通用积分
0
学术水平
0 点
热心指数
1 点
信用等级
0 点
经验
2230 点
帖子
99
精华
0
在线时间
67 小时
注册时间
2007-6-23
最后登录
2020-3-25

楼主
benny10 发表于 2010-7-15 09:38:32 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
各位前辈大家好,我在执行sas sql合并时一直出现问题,导致无法合并其讯息如下:
78   PROC SQL;
79   CREATE TABLE book3 AS
80   SELECT both.no, both.time, both.date, both.execution, both.buy, both.sell, both.p1, both.q1, both.p2, both.q2, both.p3,
80 ! both.q3, both.p4, both.q4, both.p5, both.q5, both.p6, both.q6, both.p7, both.q7, both.p8, both.q8, both.p9, both.q9,
80 ! both.p10, both.q10, both.p11, both.q11, book2.sn, book2.oq, book2.op, book2.type, book2.odate, book2.otime, book2.ep,
80 ! book2.eq, book2.edate, book2.etime, book2.bs, book2.or, book2.six, book2.bir
81   FROM both full join book on (both.no=book2.sn) and (both.date=book2.odate) and (both.time=book2.otime) ;
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Unresolved reference to table/correlation name book2.
ERROR: Expression using equals (=) has components that are of different data types.
ERROR: Expression using equals (=) has components that are of different data types.
请问这是代表什么意思呢,该如何解决呢?

目前语法为
data ep1;

infile 'e:\aaa\t200905186.txt' missover;

input a $1-2 b $3-4 c $5-6 sno 7-14 no $15-20 time 21-26 execution 27 buy 28 sell 29 d 30 e 31 f 32 g 33 p1 34-39 q1 40-47 p2 48-53 q2 54-61 p3 62-67 q3 68-75 p4 76-81 q4 82-89 p5 90-95 q5 96-103 p6 104-109 q6 110-117 p7 118-123 q7 124-131 p8 132-137 q8 138-145 p9 146-151 q9 152-159 p10 160-165 q10 166-173 p11 174-179 q11 180-187;

data ep2;

infile 'e:\aaa\t200905196.txt' missover;

input a $1-2 b $3-4 c $5-6 sno 7-14 no $15-20 time 21-26 execution 27 buy 28 sell 29 d 30 e 31 f 32 g 33 p1 34-39 q1 40-47 p2 48-53 q2 54-61 p3 62-67 q3 68-75 p4 76-81 q4 82-89 p5 90-95 q5 96-103 p6 104-109 q6 110-117 p7 118-123 q7 124-131 p8 132-137 q8 138-145 p9 146-151 q9 152-159 p10 160-165 q10 166-173 p11 174-179 q11 180-187;


data a1101;

set ep1;

if no='1101';
date=
20090518;
run;

data b1101;

set ep2;

if no='1101';
date=
20090519;
run;


data both;
set a1101
b1101;
run;
data book;


infile 'e:\abc\333.txt' missover dlm=",";

input sn $ oq op type $ odate $ otime $ eq ep edate $ etime $
bs $ or $ six $ bir $;

run;
data book2;
set book;
if sn='1101';
run;

PROC SQL;
CREATE TABLE book3 AS
SELECT
both.no,
both.time, both.date, both.execution,
both.buy, both.sell, both.p1,
both.q1,
both.p2,
both.q2,
both.p3,
both.q3,
both.p4,
both.q4,
both.p5,
both.q5,
both.p6,
both.q6,
both.p7,
both.q7,
both.p8,
both.q8,
both.p9,
both.q9,
both.p10,
both.q10,
both.p11,
both.q11,
book2.sn,
book2.oq,
book2.op,

book2.type,
book2.odate,
book2.otime,
book2.ep,

book2.eq,
book2.edate,
book2.etime,
book2.bs,
book2.or,
book2.six,
book2.bir
FROM both full join book on (both.no=book2.sn) and (both.date=book2.odate) and (both.time=book2.otime)
;
QUIT;

data book4;
set book3;
run;

二维码

扫码加我 拉你入群

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

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

关键词:correlation Expression Components Reference EXECUTION SAS

回帖推荐

pobel 发表于4楼  查看完整内容

FROM both full join book2 on (both.no=book2.sn) and (both.date=book2.odate) and (both.time=book2.otime) 另外变量date与odate, time与otime的类型应一致。

本帖被以下文库推荐

沙发
BraveMadMan 发表于 2010-7-15 09:42:35
发点样本数据和你的程序,这样别人好帮你。

藤椅
soporaeternus 发表于 2010-7-15 10:02:13
粗看下
both full join的是book 还是book2
join的表和on连接条件中的不一致......
Let them be hard, but never unjust

板凳
pobel 在职认证  发表于 2010-7-15 11:38:07
FROM both full join book2 on (both.no=book2.sn) and (both.date=book2.odate) and (both.time=book2.otime)

另外变量date与odate, time与otime的类型应一致。
已有 2 人评分经验 论坛币 热心指数 收起 理由
bakoll + 3 + 3 精彩帖子
crackman + 1

总评分: 经验 + 3  论坛币 + 3  热心指数 + 1   查看全部评分

和谐拯救危机

报纸
benny10 发表于 2010-7-15 14:54:54
不好意思,所谓的类型一致是指什么意思,是指内容一致,还是格式(字符串或数字)一致吗?

地板
soporaeternus 发表于 2010-7-15 15:06:07
5# benny10
变量类型一致,在SAS中同为字符或是数字
Let them be hard, but never unjust

7
benny10 发表于 2010-7-15 20:45:38
谢谢各位高手的帮助,终于合并成功了,果然是格式的问题!!

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-31 09:55