楼主: qyj8888
2689 7

SAS 匹配问题 求高手指教 [推广有奖]

  • 0关注
  • 0粉丝

博士生

67%

还不是VIP/贵宾

-

威望
0
论坛币
999 个
通用积分
0.0600
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
1168 点
帖子
182
精华
0
在线时间
406 小时
注册时间
2008-10-20
最后登录
2022-6-8

楼主
qyj8888 发表于 2009-12-3 21:16:39 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
在跑SAS程序时,
没报错,但是数据集为空,
自己觉得是下面这个程序有点问题,(a.model=b.model)这个匹配的时候,a数据集是大写的MODEL&i,b数据集是小写model&i,求助是不是这个问题,应该怎么处理?
谢谢~~

data ffev;
  set _null_;
run;
%macro ffev;
%do i=1 %to 9;
proc sql;
  create table ffev_temp as
  select a.*
  from ffev_&i a inner join modsel b
  on (a.permno=b.permno) and (a.model=b.model);
quit;
data ffev;
  set ffev ffev_temp;
run;
%end;
%mend;
%ffev;
二维码

扫码加我 拉你入群

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

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

关键词:求高手 inner join proc sql Create Select

data.rar
下载链接: https://bbs.pinggu.org/a-479626.html

135.45 KB

附上数据

本附件包括:

  • modsel.sas7bdat
  • ffev_1.sas7bdat
  • ffev_2.sas7bdat
  • ffev_3.sas7bdat
  • ffev_4.sas7bdat
  • ffev_5.sas7bdat
  • ffev_6.sas7bdat
  • ffev_7.sas7bdat
  • ffev_8.sas7bdat
  • ffev_9.sas7bdat

沙发
waitalone11 发表于 2009-12-3 21:24:54
from ffev_&i a inner join modsel b
里面的modsel 和b什么关系  是不是少一个点啊

藤椅
jingju11 发表于 2009-12-3 22:02:37
a数据集是大写的MODEL&i,b数据集是小写model&i,
The variable name was 'model1', 'model2' or so in the above writting while you used a.model=b.model, the variable name as 'model', in the code.
But I am not sure if that is the problem since it is very obvious.


Additionally, if data set 'ffev' was not defined prior to the macro, that could be an error. However, as you said, there was no errors in the log.

That is so far what I can see from the code.

板凳
huage 发表于 2009-12-3 22:13:31
try, modify 'on' clause as below one,
compress(a.permno)=compress(b.permno) and compress(a.model)=compress(b.model);

报纸
qyj8888 发表于 2009-12-3 22:40:24
huage 发表于 2009-12-3 22:13
try, modify 'on' clause as below one,
compress(a.permno)=compress(b.permno) and compress(a.model)=compress(b.model);
ERROR: 函数 COMPRESS 要求字符表达式作为参数 1。
ERROR: 函数 COMPRESS 要求字符表达式作为参数 1。
这样报错~~

地板
qyj8888 发表于 2009-12-3 22:41:58
jingju11 发表于 2009-12-3 22:02
a数据集是大写的MODEL&i,b数据集是小写model&i,
The variable name was 'model1', 'model2' or so in the above writting while you used a.model=b.model, the variable name as 'model', in the code.
But I am not sure if that is the problem since it is very obvious.


Additionally, if data set 'ffev' was not defined prior to the macro, that could be an error. However, as you said, there was no errors in the log.

That is so far what I can see from the code.
我前面有定义的
data ffev;
  set _null_;
run;

7
jingju11 发表于 2009-12-4 11:59:29
6# qyj8888

Change the corresponding code to

  1. on (a.permno=b.permno) and (upcase(a.model)=upcase(b.model));
复制代码


You are alright. Just a problem about different letter case. Now capitalize both and make them consistent.

8
qyj8888 发表于 2009-12-4 23:18:32
jingju11 发表于 2009-12-4 11:59
6# qyj8888

Change the corresponding code to

  1. on (a.permno=b.permno) and (upcase(a.model)=upcase(b.model));
复制代码
You are alright. Just a problem about different letter case. Now capitalize both and make them consistent.
这样我这边还是不行哈~~不知道为什么?

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

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