w*****1 发帖数: 473 | 1 【 以下文字转载自 Statistics 讨论区 】
发信人: wz99331 (dotti), 信区: Statistics
标 题: a question about SAS
发信站: BBS 未名空间站 (Mon Apr 2 12:52:18 2012, 美东)
我需要用MACRO 语言,用DO LOOP 改变一个模版的5个固定参数创建一些新的DATA,检
测这些新的DATA最大似然值.下面是我的CODE, 但是不能运行,大家能否帮我看看?包子
酬谢!
data parents; set csgl.individs;
keep i QTP pedid dgeno;
if i <=2;
run;
/* Do loops for grid search */
/*Y=g+R(mixed model), where g=Major Gene(latent fixed effect)with 3
values: mudaa, mudab, mudbb and R = Residual(variance component)*/
/*the max, min, and std w... 阅读全帖 |
|
w*****1 发帖数: 473 | 2 【 以下文字转载自 Statistics 讨论区 】
发信人: wz99331 (dotti), 信区: Statistics
标 题: a question about SAS
发信站: BBS 未名空间站 (Mon Apr 2 12:52:18 2012, 美东)
我需要用MACRO 语言,用DO LOOP 改变一个模版的5个固定参数创建一些新的DATA,检
测这些新的DATA最大似然值.下面是我的CODE, 但是不能运行,大家能否帮我看看?包子
酬谢!
data parents; set csgl.individs;
keep i QTP pedid dgeno;
if i <=2;
run;
/* Do loops for grid search */
/*Y=g+R(mixed model), where g=Major Gene(latent fixed effect)with 3
values: mudaa, mudab, mudbb and R = Residual(variance component)*/
/*the max, min, and std w... 阅读全帖 |
|
w*****1 发帖数: 473 | 3 我需要用MACRO 语言,用DO LOOP 改变一个模版的5个固定参数创建一些新的DATA,检
测这些新的DATA最大似然值.下面是我的CODE, 但是不能运行,大家能否帮我看看?包子
酬谢!
data parents; set csgl.individs;
keep i QTP pedid dgeno;
if i <=2;
run;
/* Do loops for grid search */
/*Y=g+R(mixed model), where g=Major Gene(latent fixed effect)with 3
values: mudaa, mudab, mudbb and R = Residual(variance component)*/
/*the max, min, and std will be used as grid search ranges */
%macro loops;
proc means data=parents;
var QTP;
output out=range min=min max=max std=std mean=mean;
... 阅读全帖 |
|
w*****1 发帖数: 473 | 4 Thank you very much for your help!
我改了CODE如下: 现在已运行了1小时还没有停止,大家能否帮我看看? 谢谢!
data parents; set csgl.individs;
keep i QTP pedid dgeno;
if i <=2;
run;
option symbolgen mprint mlogic;
%macro new(mudaa=, mudab=, mudbb=, de=, dq=, indata=, outdata=);
data &outdata; set &indata;
lnl=log(((1-&dq)**2)*(1/sqrt(2*constant('PI'))*&de)*exp(-0.5*(((QTP-&mudaa)/
&de)**2))+
2*&dq*(1-&dq)*(1/sqrt(2*constant('PI'))*&de)*exp(-0.5*(((QTP-&mudaa)/
&de)**2))+
(&dq**2)*(1/sqrt(2*constant('PI'))*&de)*... 阅读全帖 |
|
b******a 发帖数: 215 | 5 用proc download从远程server下载
很简单的proc
proc download in=indata out=outdata mt=(data cat);
前面几个catory的文件都下载的正常,但是突然就报错:
ERROR: Domain error.
远程文件里面就有data 和cat两种类型。
谢谢。
请问会有什么方面的问题呢? |
|
o****o 发帖数: 8077 | 6 data mydata;
input A B;
datalines;
1 1
1 1
1 3
1 3
1 5
1 23
2 4
2 4
2 6
2 6
2 12
2 22
;
run;
proc freq data=mydata noprint order=internal;
table A*B/out=order(drop=COUNT PERCENT);
run;
data order;
set order; by A;
retain Order;
if first.A then Order=1; else Order+1;
run;
proc sql;
create table outdata as
select a.*, b.Order
from mydata as a join order as b
on a.A=b.A & a.B=b.B
order by a.A, a.B
;
quit; |
|
w*****m 发帖数: 414 | 7 非常感谢 kirklanda,你的算法没有问题,完全解决了我的问题。
我以前是不知道怎么用 first.id then group=0 这一句命令。
另外讨论一个小问题,我需要把proc means的结果输出在另一个data set 里,所以我把
你的命令
改成
proc means data=a noprint;
by id group;
var x;
output
out=outdata
mean=x
median=x_m
std=x_std
sum=x_sum;
run;
结果没有问题,可奇怪的是,当我在你的原程序中直接加 noprint的时候,sas报语法
错;我把它
用output命令些出来,结果出错,我然后把class 改为 by,运行就没问题了。
没有大的变化,只是很奇怪SAS为什么这样?另给其他留个借鉴,希望有所帮助。
data a;
set a;
by id;
if first.id then group=0;
if sequence=1 then group+1;
proc print data=a;run;
proc means data=a sum mean... 阅读全帖 |
|
s*****r 发帖数: 790 | 8 because the variables maybe either numeric or non-numeric, you may consider
first create auxiliary numeric variables using the function missing. then
use proc means on all the auxiliary variables.
you can write a macro to do it automatically. something like:
%macro missing(indata, outdata);
proc contents data=indata out=_tmp;
run;
proc sql;
select name into: _name_list
from _tmp;
quit;
data _t1;
set indata;
%do loop for each variable in _name_list;
var_aux=missing(var);
run;
proc means data=... 阅读全帖 |
|
t********1 发帖数: 799 | 9 when i import a .xlsx file to sas, using
Proc import
datafile="......xlsx"
out=outdata
replace;
range="sheet name$";
getnames=no;
run;
but what i get is not the whole sheet, the column is cut at column 255, the
256th column and following columns can not be imported.
what is the problem with this?
Thank you very much for your direction and help. |
|
g****8 发帖数: 2828 | 10 %new(mudaa=&mudaa, mudab=&mudab, mudbb=&mudbb, de=&de, dq=&dq,
indata=grid, outdata=gridsearch);
这些variable都没有在macro外面定义,你怎么用呀? |
|
c******n 发帖数: 380 | 11 proc sql;
create table outdata as select unique id,date from rawdata group by id
having date=min(date);
quit; |
|
c******n 发帖数: 380 | 12 proc sql;
create table outdata as select unique id,date from rawdata group by id
having date=min(date);
quit; |
|