由买买提看人间百态

topics

全部话题 - 话题: col1
首页 上页 1 2 3 4 (共4页)
s**********o
发帖数: 14359
1
来自主题: Database版 - 请问sql 有条件性的select columns
请问这种怎么办啊
1 null null null null null null null null null
你有一个默认的RULE,如果COL1无值,就接着往后走,一直到有值
这不是CURSOR的FOR LOOP吗?
n***l
发帖数: 27
2
来自主题: Database版 - Urgent SQL problem!
SELECT a.col1, a.col2, a.col3 FROM A a
I'd like to case when a.col3 is not null then
INNER JOIN B b ON a.col3 = b.col3
case when a.col3 is null then
do not inner join B.
How to make it? Thanks million!
n***l
发帖数: 27
3
来自主题: Database版 - Urgent SQL problem!
SELECT a.col1, a.col2, a.col3 FROM A a
I'd like to case when a.col3 is not null then
INNER JOIN B b ON a.col3 = b.col3
case when a.col3 is null then
do not inner join B.
How to make it? Thanks million!
a****k
发帖数: 117
4
来自主题: Database版 - Urgent SQL problem!
SELECT a.col1, a.col2, a.col3 FROM A a INNER JOIN B b ON a.col3 = b.col3
WHERE a.col3 IS NOT NULL
w*r
发帖数: 2421
5
来自主题: Java版 - 有人用过Spring吗?
your requirement is typical for informatica work.. if your company willing
to
buy such tool . If not, write a script parser in java to parse something
like:
File=abc.dat
layout
column1Var char(10)
column2Var char(20);
insert into tableA(
col1,col2,col3) values(
simple lexicon rules, var defines in layout block, ETL/ELT block using SQL-
like
constructs to do the insert/update/upsert
Handle everything in Java using connection.preparestatement();
then you should be fine.
If application requires per
q*****g
发帖数: 1568
6
来自主题: Programming版 - Python小问题
【 以下文字转载自 Linux 讨论区 】
发信人: qiuxing (球星), 信区: Linux
标 题: Python小问题
发信站: BBS 未名空间站 (Wed Nov 1 15:05:43 2006), 转信
想要实现这么一个东西,大家参谋一下怎么弄最省事:
col0 col1 ...
row0 a00 a01 ...
row1 a10 all ...
.....
就是说带名字的矩阵。要做到可以通过行或者列的名字取出行,列。
要是能够自己带一个排序的method就更好了。
基本的思路是用dictionary套dictionary,但是我想到的方案都比较笨 :-<
又或者有现成的module?
h********l
发帖数: 67
7
来自主题: Programming版 - mySQL 问题
程序经常要用到下面的mysql语句(每秒一次左右):
update Table set col1=value1 where col2=value2
mysql和程序在同一台机子: P4 2800, 2G Memory
运行后,CPU使用率一直维持在100%. 请问这是什么
原因?谢谢!
x**l
发帖数: 369
8
来自主题: Programming版 - 急:问一个SQL的题目
SQL新手,做PROJECT碰到这样一个问题:
用户给的一个SQL语句
SELECT * FROM a
WHERE col1 = ('DE00000009')
AND (col2 = 'WRA0020' or col2 = 'OO0036' or col2 = 'WRA0019' or col2 = '
OO0033')
返回下列结果:
year col2 col3
2009 OO0033 3440.0000
2009 OO0036 330.0000
2009 WRA0019 259.9360
2009 WRA0020 1756.3800
2010 OO0033 3750.0000
2010 OO0036 375.0000
2010 WRA0019 282.4740
2010 WRA0020 2048.8700
2011 OO0033 4210.0000
2011 OO0036 285.2200
2011 WRA0019 789.3160
20... 阅读全帖
b****1
发帖数: 242
9
来自主题: Programming版 - 急:问一个SQL的题目
SELECT aaa.year,
MAX(CASE WHEN aaa.col2= 'WRA0020' THEN aaa.col3 ELSE NULL END),
MAX(CASE WHEN aaa.col2= 'OO0036' THEN aaa.col3 ELSE NULL END),
MAX(CASE WHEN aaa.col2= 'WRA0019' THEN aaa.col3 ELSE NULL END),
MAX(CASE WHEN aaa.col2= 'OO0033' THEN aaa.col3 ELSE NULL END),
FROM
(
SELECT * FROM a
WHERE col1 = ('DE00000009') AND (col2 = 'WRA0020' or col2 = 'OO0036' or col2
= 'WRA0019' or col2 = 'OO0033')
) aaa
GROUP BY aaa.year
g*********h
发帖数: 21
10
but seems tabular also not work
\begin{tabular}{|c|}
%
after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
\begin{figure}

% Requires \usepackage{graphicx}

\includegraphics[width=3in]{./Chapter-3/Figures/fusion_psnr.eps}

\end{figure}
\end{tabular}
t*******t
发帖数: 369
11
【 以下文字转载自 Statistics 讨论区 】
发信人: transient (平沙), 信区: Statistics
标 题: 请问如何在STATA中进行pcamat的操作?
发信站: BBS 未名空间站 (Tue Nov 14 11:13:12 2006)
需要用STATA对一个correlation matrix进行principal component analysis。
没有原始数据(variables),只有一个correlation matrix。
所以我是这样做的——
先产生一个matrix:
mkmat col1 **** col6, matrix(A)
然后命名行和列
最后:
pcamat A, n(100) names(.....)
但是总是说“matrix A has missing values”
试过在command里加减各种内容
基本都是说matrix has missing values
请问这个是什么意思?
(生成的matrix照我看来没有缺任何数据,因为和书上给出的一模一样。)
多谢。
x*******u
发帖数: 500
12
来自主题: Statistics版 - 请教SAS 问题
只想出这个笨办法, 有没有更简单的
data a;
input x y z m n;
cards;
1 2 3 . 4
2 3 4 5 6
1 . 3 5 6
1 3 4 . .
;
run;
proc contents data=a out=out(keep=name); run;
proc sql noprint;
select name into: name separated by ' ' from out;
run;
proc transpose data=a out=b;
run;
data c; set b;
missnum=nmiss(of col1-col4);
run;
data d(where=(missnum=0))
e(where=(missnum>0));
set c;
run;
A*********u
发帖数: 8976
13
来自主题: Statistics版 - SAS问题请教
对了,才意识到你只要AA=3,那不一定要用proc freq
用proc freq会比较容易的的把所有的AA出现过的值都统计给你
如果只要3
可以这样(trt比较多的话可以用array)
proc sort data=xxx out=xxx2 nodupkey;
by id aa;
run;
data xxx3;
set xxx2 end=eof;
by id aa;
if aa=3 then do;
if trt=1 then n1+1;
if trt=2 then n2+1;
.
.
nt+1;
end;
if first.id then n+1;
if eof;
pct1=n1/n*100;
pct2=n2/n*100;
.
.
pctt=nt/n*100;
col1=put(n1,3.)||"("||put(pct1,3.)"%)";
..
..
run;

用proc freq怎么能让一个有一个以上AA=3的ID,不重复计次呢?
谢谢!
c***y
发帖数: 50
14
来自主题: Statistics版 - 诚心请教一道sas adv题
The following SAS program is submitted:
%macro cols1;
name age;
%mend;
%macro cols2;
height weight;
%mend;
proc print data=sashelp.class;
???
run;
which statement successfully completes the programa and produces a report?
1, var %cols2 %cols1; 2,var height %col1;
3,var %cols1 height; 4,var %cols1 %cols2 height;
请问为虾米选2????
其他几个选项错在哪里
u*****o
发帖数: 1224
15
来自主题: Statistics版 - 诚心请教一道sas adv题
这个版主回答过,你可以搜搜前面的帖子。主要原因是 &col1 和&col2 resolve 后的
value 里面含有 ";"
y****1
发帖数: 400
16
来自主题: Statistics版 - 求助:SAS data set输出
我已经纠缠于这个问题有1个多星期了。是这样的:我现在在做基因方面的数据,因为
数据集的格式跟我需要的
不一样于是就读入到SAS中去转。我现在已经转好了,只要输出成.txt文本文档就可以
用了。但是问题是我虽
然只有24个observation(就是24个人),但是有将近2万个column(每个column都是这
个人某条染色体
上面的基因型)。我用命令:
data _null_;
set Imp.pedfile;
file '...';
put Family_ID Individual_ID Father_ID Mother_ID Sex Col1-Col16179;
run;
输出数据的时候虽然只有24行读入,输出就有7000多行了。这样就不行了因为中间一定
被SAS换了行,文件格
式就不对了。
大家能给我一些意见吗?有没有什么强制命令让SAS不能换行?觉得自己已经so close
到最后一步了,只差这
一点儿。老板一直催。
多谢!
y****1
发帖数: 400
17
来自主题: Statistics版 - 求助:SAS data set输出
原来的code重新run了一次,log如下:
259304 data _null_;
259305 set Imp.pedfile;
259306 file 'C:\Documents and Settings\User\My Documents\Imputation
paper\Chr21.ped';
259307 put Family_ID Individual_ID Father_ID Mother_ID Sex Col1-
Col16179;
259308 run;
NOTE: The file 'C:\Documents and Settings\User\My Documents\Imputation
paper\Chr21.ped' is:
File Name=C:\Documents and Settings\User\My Documents\Imputation
paper\Chr21.ped,
RECFM=V,LRECL=256
NOTE: 6072 records were written to th
c*********t
发帖数: 340
18
来自主题: Statistics版 - SAS新手问一个做很多次比较的问题
刚刚开始用SAS,手头上有一个dataset,col1是ID,col2是case/control信息,然后有
1000列的SNP信息,像这样
id study_status snp1 snp2 snp3 ... snp1000
1 case GG GC CC .... GG
2 control TA TT TT ..... TT
...
100 control TC TC CC ..... TT
现在想对于每一个SNP,基于这100个个体的信息,依据其case/control status对基因
频率做chi square test
分别的比较我是会的
可是如果这1000个SNP要manually做1000次比较吗
当然现在也在看宏,不过还没法自己写这样的宏(snp其实不是snp1~100这样标的,而
是rsXXX, rsXXX,没规律可犢
循,可以有类似for each column这样的命令吗)
另外,能不能把这1000次比较的P值输出到同一个文件里
g*******y
发帖数: 380
19
来自主题: Statistics版 - help for a sas question
data one;
input ID $ question $9.;
datalines;
001 question1
005 question1
009 question1
002 question2
003 question2
;run;
data two;
input ID $ question1 question2 question3;
datalines;
001 2 1 1
002 2 2 2
003 1 1 2
;
run;
proc sort data=two;
by ID;
run;
proc transpose data=two out=three name=question;
by ID;
run;
proc sql;
create table final as
select one.*, col1 from one, three
where one.ID=three.ID and one.question=three.question;
quit;
d*******o
发帖数: 493
20
来自主题: Statistics版 - 请教一个SAS问题
试试这个
data one;
input good P1 P2 P3 P4 P5 P6 P7 P8 P9 P10;
if sum(of good-P10)=11 then yes=1;
else yes=0;
cards;
1 1 0 0 1 0 1 1 0 1 0
0 0 0 1 0 1 1 0 1 0 1
1 1 1 1 0 1 1 0 1 0 1
1 1 1 1 1 1 1 1 1 1 1
;
run;
proc sort data=one; by good yes; run;
Proc transpose data=one out=two name=P;
var P1-P10;
by good yes;
run;
Proc Sql ;
create table three as
select good, p, yes,
sum( col1 , col2) as count
from two
order by p, yes
;quit;
f****r
发帖数: 72
21
来自主题: Statistics版 - 请教一个SAS问题
你的表述好像有些不太清楚。Yes如果仅仅由P(i)所决定。那么Yes就是P(i)的值,对吗?
我是个新手,你可以试试下面的程序,看对不对。
proc transpose data = yourdata out = newdata;
by name Good;
var P1 P2 P3 P4 P5 P6 P7 P8 P9 P10;
run;
data one (keep = Good P Yes);
set newdata;
P = _name_;
Yes = COL1;
run;
proc freq data = one;
tables Good*P*Yes / out = two (keep = Good P Yes Count);
run;
p*****o
发帖数: 543
22
如果我有一个DATA SET A,不知道里面有多少变量,也不知道变量的名字。
请问有没有办法讲变量的名称改为:COL1,COL2,COL3,...COLN?
谢谢!!
A*******s
发帖数: 3942
23
transpose,改col1的值,再transpose回去
A*******s
发帖数: 3942
24
oh, 刚发现一点小错误,transpose之后,默认的col1对应的其实是转置后的第二列,
你要改名的是第一列,默认的column name是_Name_
d*******1
发帖数: 854
25
proc sort data=test1; by _name_; run;
data test1;
set test1;
by _name_;
if first._name_ then i++;
_Name_=cats('col_',put(i,$10.));
run;
proc transpose data=test1 out=test2(drop=_Name_);
var col1;
id=_name_;
run;
另外一个问提是所有的numerical都变成char了, 如果原始的变量是 numerical和char
的混合的话, hehe
A*******s
发帖数: 3942
26
来自主题: Statistics版 - SAS -proc transpose 急问!
我看了一下by statement的sas help document,原来
The maximum number of observations in any BY group in the input data set is
two;
所以我能想到的变通方法是
data test;
input id a b c;
cards;
1 0 0 0
1 1 1 0
1 1 1 1
2 0 0 0
2 0 0 0
;
run;
data test;
set test;
row=_N_;
run;
proc transpose data=test out=out(drop=row rename=(_Name_=type col1=response)
);
by row id;
proc print;
run;
Obs id type response
p*****o
发帖数: 543
27
来自主题: Statistics版 - 再来问一个SAS问题
actually i coded all by myself but just not a easy way...what i really want is to find a easy way....and i do believe there should be some easy way to take care of it.
and following is just one way i tried.....
%macro assign_rand(gvar);
data t1;
set tmp3;
if a = &gvar.;
run;
data tr1;
array x x1-x27 (1 2 3);
seed = 0;
call ranperm(seed, of x1-x3);
run;
proc transpose data=tr1 out=tr2;
run;
data tr3;
a = &gvar.;
set tr2;
keep a col1;
if _NAME_ = "seed" then delete;
run;
data t2;
set tr3;
set t1;
w********5
发帖数: 72
28
来自主题: Statistics版 - 请教一下SAS编程的一个问题
This is my answer. My codes are alway very long and not efficient. Please
help simlify.
data data1;
input var1;
cards;
5
6
;
run;
data data2;
input var2;
cards;
5
6
;
run;
data new;
infile datalines dlm=" ";
input name $ var $ ;
datalines;
data1 var1
data2 var2
data2 var2
data4 var4
;
run;
proc sql;
select name into:name1-:name&SYSMAXLONG
from new;
select var into:col1-:col&&SYSMAXLONG
from new;
quit;
%put _user_;
option mprint mlogic;
%macro mutiple;
%do i=1 %to &sqlobs;
proc so
Y****a
发帖数: 243
29
来自主题: Statistics版 - 一个SAS问题(transpose?)
transpose 里有 ‘by’ statement
proc transpose data=yourdatename out=outdataname;
var var1 - var3;
by Seller Year;
run;
proc transpose data=outdataname out=newdataname;
var col1;
by Seller;
run;
try something like this, you may need to drop a few variables
i******r
发帖数: 323
30
来自主题: Statistics版 - 一个SAS问题(transpose?)
data one ;
input Seller $ Year var1 var2 var3;
cards;
ABC 2005 0 0 0
ABC 2006 4 0 0
ABC 2007 17 1 1
EFG 2005 32 4 3
EFG 2006 45 8 5
EFG 2007 50 3 12
;
run;
proc sort data=one; by seller year; run;
proc transpose data=one out=two (drop=_name_);
by seller year;
var var1-var3; run;
proc sort ; by seller year;
run;
proc transpose data=two out=three (drop=_name_) prefix=var ;
by seller year;
var col1; run;
w******a
发帖数: 25
31
来自主题: Statistics版 - imputation question?thanks
Here is an R example to impute one missing data in each record,half of the code is to make data sample, you probably only need second half,but including them here helps you understand what is going on:
The data will look like
col1 col2
x
x x
x
x x
x x
...
library(Rlab)
alp = 1
Prob_R1 = 0.5
Prob_R0 = 1 - Prob_R1
len_Y1 = 200
K_delta = 2
Y1 = rnorm(len_Y1,mean=0,sd=1)
R1 = rbinom(n=len_Y1, size=1, prob=Prob_R1)
Y2 = rnorm(n=len_Y1,... 阅读全帖
w******a
发帖数: 25
32
来自主题: Statistics版 - imputation question?thanks
Here is an R example to impute one or two missing data in each record:
The data will look like
col1 col2 col3
x
x x x
x x
x x
x x x
x
x x x
...
library(Rlab)
alp = 1
K_delta = 2
len_Y1 = 200
#Sample setting:
#Measurment N_
patient Percent
# 1 12
0.18
# 1 2 4
0.05... 阅读全帖
d*******o
发帖数: 493
33
来自主题: Statistics版 - 请教个 SAS 读数据的问题
data one;
infile whatever;
informat col300-col310 $varying.;
input col1-col500;
run;
c*******o
发帖数: 3829
34
来自主题: Statistics版 - sas 编程 - data manipulation
proc transpose data=youdata out=two(rename=(_Name_=Type col1=Amount));
by Date SeriesNO;
run;
data three;
set two;
where Amount ne .;
Type=substr(Type,5);
run;
d********h
发帖数: 2048
35
来自主题: Statistics版 - 一个sas问题
proc transpose data=test out=test1;
var feature;
by id;
data test2;
length c $ 1000;
set test1 ;
array tmp col1-col3;
do over tmp;
c=catx("_",of c tmp);
end;
proc print;
d******9
发帖数: 404
36
来自主题: Statistics版 - 一个sas问题
Nice idea.
Proc transpose 这个思路我也想到过,先 transpose , Array, 然后再合并字符串。
不过,写到半途而废了。
Array tmp col1-col3; 这里有一个问题,如果transpose 后不止3个 column,5,7个
或者更多怎么办???这里应该定义一个可变的变量才好。
h********o
发帖数: 103
37
来自主题: Statistics版 - 请教大家 这个SAS小程序怎么编
DATA ONE;
INPUT VAR $ @@;
CARDS;
A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14
;
DATA ONE;
SET ONE;
RETAIN ID ;
IF MOD(_N_, 5) = 1 THEN ID + 1;
RUN;
PROC TRANSPOSE DATA = ONE OUT = TWO (DROP = _NAME_ ID
RENAME = (COL1 = VAR1
COL2 = VAR2
COL3 = VAR3
COL4 = VAR4
C... 阅读全帖
k*******a
发帖数: 772
38
来自主题: Statistics版 - SAS problem ask for help!
data a;
input ID A B C;
datalines;
1 1 0 1
2 0 1 0
3 . 1 0
4 0 1 .
5 . . 0
;
run;
proc transpose data=a out=b;
by id;
var a b c;
run;
proc freq data=b;
table col1*_name_;
run;
i*****y
发帖数: 188
39
来自主题: Statistics版 - A R question
Hi everyone,
I have a question that needs help.
I have a data frame, let's say, 4 columns;
Now i want to calculate the ratio of col1/col4, col2/col4, col3/col4;
Sure we could do it manually. But I was just wondering if there is any
function available for doing this?
Thanks a lot
p***r
发帖数: 920
40
or you can do it in another brutal way
*WIDE TO LONG;
PROC TRANSPOSE DATA=data1 OUT=data2;
BY var_id;
VAR _ALL_;
RUN;
data data3;
set data2;
log_var=log(col1);
run;
*LONG TO WIDE;
PROC TRANSPOSE DATA=data3 OUT=data4
BY var_ID;
ID variable;
VAR log_var;
RUN;
r*********o
发帖数: 490
41
来自主题: Statistics版 - 请问sas如何做两万次ttest不崩溃?
我用的code框架如下,sas总是崩溃,有啥好办法?
ods listing close;
ods output ttests=pvals;
proc ttest data=sashelp.class;
class sex;
var col1-col20000;
run;
ods output close;
ods listing;
t***s
发帖数: 30
42
来自主题: Statistics版 - 很挑战的data transformation problem help
根本不需要var呀。
proc transpose data=啊 out=b(rename=(col1=unemployment)) name=countyname;
by date;
run;
y********0
发帖数: 638
43
来自主题: Statistics版 - 问SAS code怎么写
是用sql,转置一下,取个最小值就成。
data one;
infile datalines;
input id date mmddyy10.;
datalines;
1 08/12/2005
1 09/13/2005
2 01/09/2005
3 01/08/2005
3 01/08/2005
3 02/09/2005
;
proc transpose data=one out=two;
by id;
run;
proc sql;
select id,min(col1,col2,col3) as mdate format=mmddyy10.
from two;
quit;
j*****g
发帖数: 36
44
来自主题: Statistics版 - 重新安排变量的问题
proc transpose data = dataset0 out=dataset1 name=variable;
by farm year land;
var var1-var3;
drop _label_;
run;
proc sort data = dataset1;
by farm land variable year;
run;
data dataset2(drop = variable year); set dataset1;
newId = catx("_", variable, year);
run;
proc transpose data = dataset1 out =dataset2;
by farm land;
id = newId;
var = col1;
drop _name_ _label_;
run;
w******a
发帖数: 986
45
来自主题: Statistics版 - 这个在excel里怎么实现
column1是A,B,C,D. Column2是对应的值。想把每个column2里的值所对应的A,B,C,D给
sum一下。比如下面这个简单的例子, A加起来16 (1+15),B为4。 这个怎么在excel
里实现。Thanks
col1 col2
A 1
A 15
B 2
C 5
D 6
B 2
w*******n
发帖数: 469
46
来自主题: Statistics版 - 操作pair data加flag
flag=ifc(col1
i******r
发帖数: 861
47
来自主题: Statistics版 - 操作pair data加flag
谢谢,谢谢。
再问:col1//col2均为字符,怎么可以用>来比较?
R******d
发帖数: 1436
48
来自主题: Statistics版 - 重复测量中单个时间点的组间差异
习惯用proc glm做重复测量分析,分组差异,时间差异,交互作用和单时间点的组间差
异一次全部给出。
proc glm data=data2;
class group;
model t1-t6=group;
repeated time 6 (1 2 3 4 5 6);
run;
现在想换proc mixed,分组差异,时间差异,交互作用都有,但是单时间点的组间差异
没有输出,请问应该怎么写才能输出这个?
proc mixed data=data;
class group individual time;
model col1=group time group*time;
random individual(group);
repeated time/sub=individual(group) type=ar(1);
run;
多谢了。
首页 上页 1 2 3 4 (共4页)