由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - SAS高手请进:20包子
相关主题
请教一个SAS SQL的问题关于SAS里面 PROC MODEL 的output,急!!
proc glm questionsSAS问题求助
请教SAS SQLSAS -proc transpose 急问!
请教SAS问题问个SAS入门级的问题。。多谢。。
请教一sas code[SAS] data set options (obs=) in output tables
a SAS questionhelp: proc logistic
SAS DATA 求助SAS code 问题
问个SAS output的问题SAS菜鸟请教如果使SAS的output的结果放到一个文件内?
相关话题的讨论汇总
话题: us话题: bquant话题: cquant话题: centers
进入Statistics版参与讨论
1 (共1页)
t**********r
发帖数: 182
1
My boss gave me this work in the morning and I had no idea. Please help. 奉
送20包子
two datafiles: one is all US blood centers information; and the other one is
all Canada blood centers information. The files are like this:
File 1: US blood centers
US_bloodcenterID; Date; US_AQuant; US_BQuant;
File 2: Canada blood centers
CAN_bloodcenterID; Date; CAN_AQuant; CAN_BQuant;
Purpose: for every US_bloodcenterID, select one CAN_bloodcenterID on the
SAME date to generate ONE file; but this one
t**i
发帖数: 688
2
How many records per bloodcenterID?
One quick clue is to make cross-join first between US and CAN, then for each
US-CAN ID pair, find the single record with minimal difference between US_
BQuant and CAN_BQuant only.
t**********r
发帖数: 182
3
Could you please write some code for me? use proc sql???
For each date yyyymmdd, there are thousands of bloodcentersID.
thanks.
q**j
发帖数: 10612
4
very easy. maybe slow but it will work
proc sql;
create table output as
select a.*, b.*, diff = a.US_bloodcenterID - b.CAN_BQuant
from uscenter a, canadacenter b
where a.date = b.date
order by a.US_bloodcenterID, a.Date, diff;
quit;
data output;
set output;
by US_bloodcenterID USDate;
if first.USDate;
run;
50 baozi please! if you cannot sort by diff in proc sql, sort it in a separate proc sort step.
t**********r
发帖数: 182
5
Many thanks!!!!
Let me run the code and BZ will be coming!!!!

【在 q**j 的大作中提到】
: very easy. maybe slow but it will work
: proc sql;
: create table output as
: select a.*, b.*, diff = a.US_bloodcenterID - b.CAN_BQuant
: from uscenter a, canadacenter b
: where a.date = b.date
: order by a.US_bloodcenterID, a.Date, diff;
: quit;
: data output;
: set output;

q**j
发帖数: 10612
6
i modified the code a little. but no major change.
t**********r
发帖数: 182
7
Thank you so much.
A further question.
I have a third variable: US_CQuant and CAN_CQuant. When selecting from CAN_
BloodcenterID, I need also to make sure that the difference between US_
CQuant and CAN_CQuant is the minimum.
Can you also help me with this?

【在 q**j 的大作中提到】
: i modified the code a little. but no major change.
q**j
发帖数: 10612
8
see the modified code. here i assume diff1 is more important than diff2.
proc sql;
create table output as
select a.*, b.*, diff1 = a.US_BQuant - b.CAN_BQuant,
diff2 = a.US_CQuant - b.US_CQuant
from uscenter a, canadacenter b
where a.date = b.date
order by a.US_bloodcenterID, a.Date, diff1, diff2;
quit;
data output;
set output;
by US_bloodcenterID USDate;
if first.USDate;
run;
t**********r
发帖数: 182
9
Thanks a million!!!! BZ has come to your a/c.

【在 q**j 的大作中提到】
: see the modified code. here i assume diff1 is more important than diff2.
: proc sql;
: create table output as
: select a.*, b.*, diff1 = a.US_BQuant - b.CAN_BQuant,
: diff2 = a.US_CQuant - b.US_CQuant
: from uscenter a, canadacenter b
: where a.date = b.date
: order by a.US_bloodcenterID, a.Date, diff1, diff2;
: quit;
: data output;

q**j
发帖数: 10612
10
多谢多谢。今天刚花了50个包子打听消息,没想到立刻就回本了。我的code肯定是不能
立刻就run的。但是问题很小很小。你稍微改改就行了。不行给我发message吧。俺滴
code是有warranty的。
1 (共1页)
进入Statistics版参与讨论
相关主题
SAS菜鸟请教如果使SAS的output的结果放到一个文件内?请教一sas code
这个OUTPUT怎么看啊?a SAS question
SAS questionSAS DATA 求助
中级SAS问题问个SAS output的问题
请教一个SAS SQL的问题关于SAS里面 PROC MODEL 的output,急!!
proc glm questionsSAS问题求助
请教SAS SQLSAS -proc transpose 急问!
请教SAS问题问个SAS入门级的问题。。多谢。。
相关话题的讨论汇总
话题: us话题: bquant话题: cquant话题: centers