由买买提看人间百态

topics

全部话题 - 话题: proc
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
B******y
发帖数: 9065
1
来自主题: Statistics版 - proc GLM和proc Reg、proc Genmod的比较
SAS中的PROC GLM的命名有重大的欺骗性,这里的GLM是指General Linear Model,而不
是Generalized Linear Model!!!一字之差,区别很大。PROC GLM是一种ANOVA的扩
展,是基于PROC ANOVA的更新程序(PROC GLM出了以后,PROC ANOVA基本上废了);而
PROC GENMOD才是大家常见的将非正态数据转成正态模型的,所以需要Link Function。
据说SAS公司后来非常后悔PROC GLM的定义,毕竟学术界更习惯于GLM是Generalized
Linear Model的缩写,但PROC GLM出现Generalized Linear Model被普遍接受之前,而
且SAS使用者已经习惯用它了。所以没有办法,只好创造了一个新的PROC GENMOD。
f**********t
发帖数: 1001
2
来自主题: Statistics版 - proc GLM和proc Reg、proc Genmod的比较
有些疑惑。。。
1.proc GLM到底是Generalized Linear Regression么?看了SAS的文档半
天,没见Link function啊。感觉就对所有的independent variable做
traditional Linear regression了。感觉proc Genmod才是在做
Generalized Linear Regression。
2.proc GLM和proc Reg的差别主要在哪?是不是对于proc Reg而言,
independent variable不能包括categorical variable, nominal
variable和interaction?
非常感谢!
f**********t
发帖数: 1001
3
来自主题: Statistics版 - proc GLM和proc Reg、proc Genmod的比较
非常感谢!我当时就是觉得Proc GLM太具欺骗性了才问的。哈哈。
回答对我很有帮助。
感觉Proc GLM是兼具Proc ANOVA和Proc Reg的功能。Proc ANOVA确实没怎么见到用过。
i*o
发帖数: 702
4
除了proc reg和proc logistic的指令不同,model其他的全部相同(independent vars,
depdent var),为什么用proc logistic得出的coefficients和proc reg的全部相反以
至于无法interpret?多谢大牛指教。
reg和logistic的codes如下 ("used" is a binary variable, 0=not used; 1=used):
proc reg; model used=race v103 v2000 v2007 v2020 v2015 finstr_w1 v2612
depress1;
run;
proc logistic; model used=race v103 v2000 v2007 v2020 v2015 finstr_w1 v2612
depress1;
run;
b*****e
发帖数: 223
5
来自主题: Statistics版 - proc report与proc tabulate有什么区别?
我几乎没用过 proc tabulate,可能学生时候偶尔用过一两次。前不久我查 proc
report 的时候,有篇文章好像是这么说,有了 proc report, proc tabulate 就几乎
被取代要淘汰了。公司里应该是 proc report,data _null 的方法用得比较多。
A*********u
发帖数: 8976
6
来自主题: Statistics版 - proc report
data _null_; with put statements were the old fashion
tools when the proc report and ods rtf were still
not that powerful.
now, more and more ppl are using proc report and
ods rtf.

I try to use proc report to do the listings, and i have trouble of ODS, page
count etc. I try to find some trick but can't get much.
So i review the other programmer's codes and found most of them use data
steps instead of proc report.
If that proc report is not that popular in pharma TFLs?
P****l
发帖数: 156
7
来自主题: Statistics版 - proc GLM和proc Reg、proc Genmod的比较
reg只要是 linear function
glm is generalized linear model
主要区别,reg只可以用 continuous independent variable
proc glm 可以用来做任何的 generalized linear model
proc glm 是不用 link function 的
proc genmod 才要指出用什么 link function
其实去 sas网站上的那个support 多看看就就知道了
a****m
发帖数: 693
8
来自主题: Statistics版 - proc GLM和proc Reg、proc Genmod的比较

in Proc GLM model, the input variable can be categorical or continuous,
but only fixed effect only.
whereas PROC REG only count on the continuous input variable, and ANOVA is
for categorical variable.
PROC GLM is extended form of ANOVA, it could be ANCOVA, called analysis of
covariance. it need at least one continuous and at least one categorical
input variable. it is merger of ANOVA and regression for continous
variable.
D******n
发帖数: 2836
9
来自主题: Statistics版 - 神奇的proc means
this way works, but stacking data is not that efficient. I came up with this
, just do more data manipulation on the means output.
----------------------------------------------->
data a1;
input x_1 y z weight;
datalines;
1 0 4 0.1
1 0 4 0.5
0 1 1 0.2
0 1 1 0.2
1 0 2 0.1
0 1 2 0.5
1 0 3 0.2
0 1 3 0.2
;
run;
proc means data=a1 noprint;
var x_1 y z;
weight weight;
output out=b sum= mean= nmiss=/autoname;
run;
proc transpose data=b(drop= _type_ _freq_) out=b2;run;
data b2;
... 阅读全帖
a*z
发帖数: 294
10
来自主题: Statistics版 - 请问一个SAS proc sql的写法
use SAS proc sql case when.
Follow is my code. It works under SAS 9.4.
data A;
input id $ x y;
datalines;
01 3 4
02 4 5
03 5 6
04 6 7
;
run;
proc print; run;
data B;
input id $;
datalines;
02
04
06
;
run;
proc print; run;
proc sql;
create table want as
select A.*, case when id in (select id from B) then 1 else 0 end as idx
from A;
quit;
proc print; run;
Result:
Obs id x y idx
1 01 3 4 0
2 02 4 5 1
3 03 5 6 0
4 04 6 7 1
Try it out to see if this is what you want.
W*****r
发帖数: 193
11
用各个csv的id合并起来
简单的的我知道怎么做
比如
proc import datafile="D:file1.csv"
out=new1 dbms=csv replace; getnames=yes;
run;
proc print data=new1;
run;
proc import datafile="D:file2.csv"
out=new2 dbms=csv replace; getnames=yes;
run;
proc print data=new2;
run;
data dn;
merge new1 new2;
by id;
run;
文件“dn”含new1 和 new2的所有variables, 使用公用的id
问题是,如果csv files很多怎么办?比如100+?
可不可以用proc sql + Macro做出来?
怎么做?
多谢。
W*****r
发帖数: 193
12
有点没看明白
比如5个csv files(文件名叫dr1.csv, dr2.csv,...,dr5.csv) 在 d:\filename\文件夹下
下面的code应该怎么改?
%macro multimp(dir=,out=);
* Make sure output ds does not exist ;
proc delete data=&out; run;
* Read list of filenames and generate PROC IMPORT and PROC APPEND for each one ;
filename code temp ;
data _null_ ;
infile "dir ""&dir\btlt4-*.csv"" /b" pipe truncover;
input filename $256.;
file code ;
put 'proc import datafile="&dir\' filename +(-1) '" out=onefile replace;'
/ 'run;'
/ 'proc append d... 阅读全帖
d*2
发帖数: 2053
13
MegaSAS controller
RHEL 5.8 x64
among several disk (exact same model and controller):
/proc/partitions
sda
sda1
sda2
sda3
sda4
sdb
sdb1
sdb2
sdb3
sdb4
sdc
sdc1
sdc3
sdd
sdd1
sdd2
sdd3
sdd4
...
Tried to use fdisk to delete existing partitions on sdc and repartition it
to be the same as other disks, command operations all succeeded, but /proc/
partitions content just won't update.
tried:
delete partition, then export/import partition table from other disk
use dd to wipe out the partition table and... 阅读全帖
R****9
发帖数: 815
14
有150个病人,分别在5个时间点(术前,术后1一年,术后两年,术后三年,术后四年
)测试视力,每个时间点测三次(左眼,右眼,双眼)的视力。
想知道时间,眼睛,以及时间*眼睛的作用.
请问该用什么proc mix?有什么不同? Thanks!!!!!!
1. proc mixed;
class eye subid;
model score = time eye time*eye/solution;
random int /subject=subid;
run;
2. proc mixed;
class eye subid;
model score = time eye time*eye/solution;
random subid*eye;
run;
3. proc mixed;
class eye time subid;
model score=time eye time*eye/ddfm=kr;
random subid*eye;
repeated / type=ar(1) subject=subid*eye;
t****n
发帖数: 1879
15
来自主题: Statistics版 - SAS 数据读入的问题 (proc import)
针对一般的excel使用proc import做data input还是蛮简单的。
但是如果有new data update,新的excel file中个别的variable常常改变了format,
比如numeric变成了character或者反之。再使用proc import出来的new sas dataset就
不能与旧的merge了。
而proc import 本身也有问题,就算是同一个excel,不同的电脑做proc import,有时
候,同一个variable居然会出来不同的format。
大家有什么妙法吗?
先谢了。
s********a
发帖数: 154
16
在做一组数据的repeated analysis, 数据有missing value 用proc mi 生成10 sets
数据,然后proc mixed repeated analysis,接下来该怎样用proc mianalyze 得到
fixed effects 的p value?fixed effects 有categorical vars, 请牛人支招,谢谢
h*******e
发帖数: 68
17
☆─────────────────────────────────────☆
antonioxy (有绿卡不如学CS) 于 (Tue Jul 25 20:56:28 2006) 提到:
好歹都是很资深的程序员了,还犯这种错误,一段大程序改下来真是烦死,比如说这么个
东东:
data d1;
input a b c;
datalines;
1 2 3
1 5 6
1 2 3
2 4 6
;
proc sort data=d1 nodup; by a; run;
这个sort就错了,为什么,运行一下就知道,根本不能去掉第三行重复的数据,正确的应


proc sort data=d1 nodup; by _all_; run;

proc sql;
create table d1 as
select distinct * from d1 order by a;
quit;
sql更好一点因为可以规定排序的变量。
☆─────────────────────────────────────☆
papertigra (长工胖头猪) 于 (T
A*********u
发帖数: 8976
18
来自主题: Statistics版 - [合集] 一个关于Proc Qlim的问题
☆─────────────────────────────────────☆
jujiu (~~~~lala) 于 (Fri Jan 25 14:55:56 2008) 提到:
我想改变iteration number。根据proc qlim help, 下面的程序好像就可以了,可是
run起来总是出错。大侠指教一下吧。
proc qlim data=a;
model y=x /discrete maxiter=500;
run;
☆─────────────────────────────────────☆
oloolo (黑夜给了我白内障) 于 (Fri Jan 25 15:22:58 2008) 提到:
error info?

☆─────────────────────────────────────☆
jujiu (~~~~lala) 于 (Fri Jan 25 15:35:56 2008) 提到:
492 proc qlim data=a ;
493 model Y = X / discrete maxiter=500;
m*****8
发帖数: 654
19
来自主题: Statistics版 - proc report
I try to use proc report to do the listings, and i have trouble of ODS, page
count etc. I try to find some trick but can't get much.
So i review the other programmer's codes and found most of them use data
steps instead of proc report.
If that proc report is not that popular in pharma TFLs?
o******6
发帖数: 538
20
☆─────────────────────────────────────☆
hemmingchen (天高海阔) 于 (Wed Jan 28 09:14:52 2009) 提到:
Suppose I have a large data set collected from many different sites. I try
to analyze the data with PROC GLM for two effects (e.g. gender---male and
female, and blood types---O, AB, B, A). When I use PROC GLM for all sites
with combining gender and blood types to be a new variable as Gen_Blood, “
PROC GLM with Tukey lines” works perfectly for all sites together.
However, when I try to use “BY sites”,
S******y
发帖数: 1123
21
If you run the following code, you will see the disagreement between PROC
FREQ results and PROC UNIVARIATE (histogram) results on the SAME data.
On uniform data, PROC UNIVARIATE (histogram) generates two-level values --
Why??
Thanks.
A*******s
发帖数: 3942
22
data test;
input X $ Y;
cards;
a 34
a 45
a 7
a 12
a 11
b 1
b 56
b 66
c 19
c 43
c 12
c 71
;
run;
可以用number option产生行号,但是不能改column name。用monotonic()的结果很混
乱,不大清楚这个函数的机制是什么。
proc sql number;
select monotonic() as Num, X, mean(Y) as mean
from test
group by X;
quit;
我也尝试了用subquery来搞,但是结果还是一样。
proc sql number;
select monotonic() as Num, * from
(select X, mean(Y) as mean
from test
group by X);
quit;
唯一行得通的方法是先create table as,再用monotonic()。那为啥subquery不行呢?
proc sql;
create
R******d
发帖数: 1436
23
来自主题: Statistics版 - 问一个proc sql的问题,多谢
两个表。一个10000多行(a),第二个一个100000000行(b)。我用proc sql把这两连接起
来。好比:
proc sql noprint; create table c as
select table a.g1, a.g2, b.value from a left join b on a.g1=b.id1 and a.g2=b
.id2;
quit;
我发现value,也就是来自第二个表的数据是空的。检查了一下原始数据,应该是有的
。请问这是什么原因,是不是proc sql对处理的表有什么上限?
多谢了
e****o
发帖数: 690
24
来自主题: Statistics版 - proc sql: find 4 highest and mean, median
how to find 4 highest and mean, median, I don't know to get median by
industry as grouping except using proc means. Any good coding?? 3X for your
reply.
data temp;
do i=90 to 107;
xx=abs(i/i**2 -100*uniform(7));
industry = 10;output;
end;
do i=108 to 130;
xx=abs(i/i**2 -100*uniform(7));
industry = 20; output;
end;
run;
proc sort data=temp; by industry descending xx;
data t1;
set temp;
id + 1;
if first.industry then id =1;
run;
data t2 ;set t1 ;
if id<5;
run;
proc
j*****t
发帖数: 83
25
用PROC PMENU取得user inputs,然后在新的data set 中创建3个新变量并且让这3个新
变量等于PROC PMENU过程中输入的3个值。
可是程序第一次运行的时候系统提示:“symbolic variable not resolved."第二次运
行的时候就会取第一次运行时输入的值,第三次运行的时候取第二次输入的值。为什么
我的macro variables会慢一轮?
PROC PMENU catalog=menulib.gmdcat;
MENU gminput;
ITEM 'Please make your selections' dialog=Schlprd;
DIALOG Schlprd 'END;%%LET schoolname=%1;%%LET admin=%2;%%LET year=@1;RUN';
TEXT #1 @1 'Select School Name';
RADIOBOX DEFAULT=1;
RBUTTON #2 @1 'Gill Elemenary';
RBUTTON #
p*****o
发帖数: 543
26
我有两个DATASET, 1 AND 2. 其中2是1的子集。如何用PROC SQL来生成一个新的DATA
SET=DATASET1 - DATASET2.。。。
DATASET1中有10个变量(VAR1,VAR2,...,VAR10),DATASET2中有三个变量(VAR1,VAR2,
VAR3--跟DATASET1中对应的)
试了
PROC SQL;
SELECT * FROM DATASET1 EXCEPT SELECT VAR1 FROM DATASET2;
是不是EXCEPT中只能最后选出一个变量?(PROC SQL;
SELECT VAR1 FROM DATASET1 EXCEPT SELECT VAR1 FROM DATASET2;)
y*********s
发帖数: 24
27
来自主题: Statistics版 - help: proc logistic
how to save the result of proc logistic model in a data set?
I tried the code as below in the proc logistic and print the data set out.
output out = filename;
however, it turns out it only prints out the original data set.
Is something I did wrong?
ps: I would like the model based on the training set to be assessed using
the rest of the data set. So I need to get the coeff of the model, that is
why I want to record the output of proc logistic in a data set.
Is there a much better way to do this?
m*i
发帖数: 8
28
来自主题: Statistics版 - help with contrast statement in proc genmod
Hi,everybody
I have a question about how to write contrast in proc genmod to test whether
the effect of the two dummy variables are simultaneously zero, is the
following contrast correct? If not, how should I write the contrast?
Thanks in advance and happy holiday.
MDI
proc genmod data=work.tmp descending;
title "GEE";
class IDSubject dum1(ref='0') dum2(ref='0') /param=ref;
model &depVar=dum1 dum2/link=logit dist=bin offset=logmiles lrci waldci
type3;
repeated subject=IDSubject/type=ind;... 阅读全帖
k*****u
发帖数: 1688
29
来自主题: Statistics版 - proc GLM和proc Reg、proc Genmod的比较
proc mixed也用来做方差分析啊
l***a
发帖数: 12410
30
来自主题: Statistics版 - proc report与proc tabulate有什么区别?
personally I never used proc report. always proc tabulate
b*****e
发帖数: 223
31
来自主题: Statistics版 - proc report与proc tabulate有什么区别?
proc tabulate 在 proc tabulate 之后就渐渐要被淘汰了吧?
l*****k
发帖数: 587
32
来自主题: Statistics版 - sas proc transpose can do this?
I can do it in R, but not sure if sas can also handle it.
I have 26 lists, now I want to generate their pairwise overlaps
I did the overlap in R, now the output is
list1 list2 both_up both_down
a c x x
a b x x
a c x x
.
.
.
b a x x
b b x x
.
.
.
list1 is actually list2, the whole paiwise comparison has 26*26 row
can I transform it to matrix format using proc transpose?
the result should have list1 as ro... 阅读全帖
a******n
发帖数: 11246
33
来自主题: Statistics版 - 请教一下sas proc ANOVA.
关于proc anova, sas documents里有这么一段:
Use PROC ANOVA for the analysis of balanced data only, with the following
exceptions: one-way analysis of variance, Latin square designs, certain
partially balanced incomplete block designs, completely nested (hierarchical
) designs, and designs with cell frequencies that are proportional to each
other and are also proportional to the background population. These
exceptions have designs in which the factors are all orthogonal to each
other.
link在这里:http://suppo... 阅读全帖
d*******o
发帖数: 493
34
来自主题: Statistics版 - 请问SAS大牛一个关于proc sql join
我猜1。Proc SQL的第一步是判断有没有equijoin,如果不是才会用step loop形成
Cartesian product。所以normalize database才这么重要。
可以看下面这个例子里面log的执行方案,2比1复杂的多。
data a b;
set sashelp.class;
rename name = id;
run;
proc sql _method;
select a.* from a, b
where a. id =b.id;
quit;
proc sql _method;
select a.* from a, b
where a.id in
(select distinct id from b);
quit;
m******t
发帖数: 44
35
来自主题: Statistics版 - 新手求教:关于sas proc mianalyze
在用处理一个logistic regression(有多个解释变量 都是连续的),code 如下:
第一步
proc genmod data=datcom descend ;
model bidd = pdhdS1 pdnhS1 E age educyears D / dist=bin link=logit CovB;
by _Imputation_;
ods output ParameterEstimates=paraest CovB=covmat;
run;
这里生成了2个ods table.按理说,因为是multivariate inference,所以第二步
mianalyze应该采用如下code:
proc mianalyze parms=Paraest covb=covmat;
modeleffects intercept pdhdS1 pdnhS1 E age educyears D;
ods output ParameterEstimates=parameterest VarianceInfo=vinfo;
run;
在proc mianalyze输入data的时候,p... 阅读全帖
s***r
发帖数: 1121
36
来自主题: Statistics版 - SAS proc means qusetion, 3 baozi
How can I estimate t value using the heteroskedasticity-consistent standard
errors in a PROC MEAN (see below)? (NOT in a PROC REG)
proc means data=a1 noprint; var var1; by byvariable;
output out=a2 mean=mean1 t=tret;
run;
3 baozi will be given for the first 3 replies. thanks.
o****o
发帖数: 8077
37
来自主题: Statistics版 - 神奇的proc means
也许可以试试PROC STDIZE
data a1;
input x_1 y z weight;
datalines;
1 0 4 0.1
1 0 4 0.5
0 1 1 0.2
0 1 1 0.2
1 0 2 0.1
0 1 2 0.5
1 0 3 0.2
0 1 3 0.2
;
run;
ods select none;
proc stdize data=a1 out=_null_ outstat=stat pctlpts=0 100;
var x_1 y z ;
weight weight;
run;
ods select all;
proc transpose data=stat out=stat2 ;
id _type_;
run;

痛。
c**********e
发帖数: 2007
38
来自主题: Statistics版 - A problem on PROC SQL
Which of the following PROC SQL steps display the name (Memname),
modification date (Modate), number of variables (Nvar), and the number of
observations (Nobs) for each table in the Sasuser library?
(A)
proc sql;
select memname, modate, nvar, nobs
from dictionary.tables
where libname='SASUSER';
quit;
(B)
proc sql;
select memname, modate, nvar, nobs
from dictionary.tables
where libname='Sasuser';
quit;
(C) Neither A nor B.
My question is: what is the dictionary lib in (A) ... 阅读全帖
p********2
发帖数: 9939
39
来自主题: Statistics版 - 请问proc genmod, sas问题
我想run一个regression allowing for error correlation within certain clusters.
比如说,year 和 firm。
proc genmod的一个选项是repeated subject。看了看好像这就是用来specify一个
cluster where errors are correlated within this cluster.但是我要specify两个
clusters。它要我写成year*firm。这是什么意思呢?为什么有*。表示interaction?
if yes,怎么个interaction法呵?如果有三个cluster呢?
还有一个问题,我得model不能converge
WARNING: The negative of the Hessian is not positive definite. The
convergence is questionable.
WARNING: The procedure is continuing but the validity of the model fit i... 阅读全帖
g****8
发帖数: 2828
40
来自主题: Statistics版 - 关于proc sql left join的一个问题
不知道下面这个行不行,没有test过。而且如果你的b里面variable多的话,keep那里
要写很多的话,就没有sql的方法efficient了。
如果a里面variable少,改成drop也行。
proc sort data=a; by id provider;run;
proc sort data=b; by id provider;run;
DATA test;
Merge a (in=t1) b(in=t2);
by id provider;
if (t1=1 and t2=0 ) then delete;
if( t1=1 and t2=1 and begdate<=admsn_dt and enddate>=dschrgdt ) then
delete;
keep ;
run;
proc sort data=test nodupkey;by ***; run;
x***I
发帖数: 91
41
来自主题: Statistics版 - 请教一个proc sql的问题
最近在看sas programing in pharmaceutical industry.
看到作者用proc sql合并datasets,可是不知道为什么,最后一个记录出不全。
自己运行一下他的程序也是一样的,我用的是SAS9.2.
这个有什么办法解决么。
Program 4.8 Performing a Many-to-Many Join with PROC SQL
**** ADVERSE EVENTS;
data aes;
informat ae_start date9. ae_stop date9.;
input @1 subject_id $3.
@5 ae_start date9.
@15 ae_stop date9.
@25 adverse_event $15.;
datalines;
101 01JAN2004 02JAN2004 Headache
101 15JAN2004 03FEB2004 Back Pain
102 03NOV2003 10DEC2003 Rash
102 03JAN2004 10JAN2004 A... 阅读全帖
s********e
发帖数: 323
42
来自主题: Statistics版 - 请教一下proc ttest, weighted data
用proc ttest,加上weight了,结果里的mean应该是weighted mean吧,df用的是原来
的unweighted N。这样对吗?
在网上看到这么做的,
先用proc means加上weight,算weighted mean,assign成一个data,然后在用proc
ttest,不加weight,这样的话mean和df都和前面一样,但是t statistics不一样,结
果p value也不一样。
到底应该用哪个啊?
多谢!
b******s
发帖数: 345
43
怎样在unix下使用在windows下产生的format?google到需要用PROC CPORT及PROC
CIMPORT,请大家 能不能给个例子,尤其是关于transport file的写法,谢谢!
p********a
发帖数: 5352
44
use proc format cntlout 转化成SAS DATA,MOVE 到UNIX, 然后用PROC FORMAT
CNTLIN重新CREATE FROAMTS
e******e
发帖数: 410
45
来自主题: Statistics版 - SAS 求助 PROC EXPORT 非空文件
需要用PROC EXPORT 导出几个文件
proc export data=table_1;
....
run;
需要判断这个文件(如上面的table_1)是不是空文件(一个obs都没有,只有变量名)
。 如果是空文件的话就自动不运行这个proc export 命令。
有同学知道这个怎么实现嘛? 多谢多谢。
y********0
发帖数: 638
46
来自主题: Statistics版 - PROC SQL运行速度问题.
最近用proc sql通过ODBC连接数据库,用的A left join B查询,其中B是SQL
architecture数据库下的一个table. 速度极其的慢,大约要一两个小时,最近老被管理
员揪,说没有看见where-
filter,会造成服务器负担.
我的proc sql 下使用了where,但是管理员端收到的query里没有看到任何的filter. 想
问一下:
1. sas 下的proc sql是什么原理阿,是发送query到服务器端,然后接受结果么? 还是
sas自己本身集成了SQL module,把那个服务器端的server当作linked server? (这个问
题有可能问的不对,错了请指正).
2. SAS odbc连接原理和sql server management studio 原理一样吗?同样的query, 用
sql sever mgt studio只需要一两分钟.但是SAS真的很慢阿.
谢谢啦.
z*****h
发帖数: 111
47
求助高手,在sas中经常需要以下操作
proc sql;
create table tb as select
a.*, b.val
from left a left join right b
on a.ID=b.ID
and 1<=intck('month', b.date, a.date)<=60;
quit;
这个方法很慢,看了下用hash,貌似只能实现equality join. 有想过用proc expand
把left表中的每一个date扩展成整个过去的60个月,然后用date step merge 或者
hash. 这样就能把inequality join 变成 equality join, 但是不知道怎么实现。
请教proc expand 的方法怎么实现,另外如果有更好的方法,请不吝赐教!
n*a
发帖数: 124
48
来自主题: Automobile版 - Manuf. Delv, Proc, & Hndlg 能讲价吗?
Dealer列了base MSRP,还有 Manuf. Delv, Proc, & Hndlg 和dear fee。是不是Manuf
. Delv, Proc, & Hndlg讲不下价,但dealer fee 可以?谢谢.
t**********r
发帖数: 182
49
Want to merge two data sets using proc sql:
Data1:
var1 var2 date1
Data2:
var1 var2 date2 rating
(Note: var1 and var2 are the same variables in these two data sets)
Question:
Select rating in data2 to data1; meeting the following criteria:
1. date1 - date2 >0
2. date1 - date2 has the minimum value.
I wrote the following code; but it won't work:
proc sql;
create table data3 as
select data1.*, data2.rating, date1-date1 as diff
from data1, data2
where data1.var1=data2.var1 and data1.var2=data2.var2
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)