Thursday, May 8, 2008

Create a variable having value of median in categories

To find the median values of the categories (e.g. to assess test of trend)


%macro hint(var1,var2);

proc means data=fret median;
class &var1;
var &var2;
OUTPUT OUT=&var2 MEDIAN= ;
run;

data null;
set &var2;
call symputx("&var2.m"||put(_n_,1.),&var2,'g');
run;
%put &var2.m;
%put _user_;
%mend;
**depending on the number of categories (n), you would have n+1 macro variables.
**********run like this *************;
%hint(_alcoc,alc) /***_alcoc has 4 categories **/

/*** this would create macro variables as &alcm2 - &alcm(n+1)***/

data new;
set fret;

if _alcoc =. then alcm = .;
else if _alcoc =1 then alcm=&alcm2; /**note this is &alcm2 ***/
else if _alcoc =2 then alcm=&alcm3;
else if _alcoc= 3 then alcm=&alcm4;
else if _alcoc = 4 then alcm=&alcm5;

5 comments:

Anonymous said...

成人視訊,色情影片,台灣無限貼圖,美女交友,成人,6k聊天室,ut聊天室,免費視訊,免費視訊,台灣美女貼圖區,免費交友,正妹視訊,成人視訊,正妹星球,情色視訊,dudu 嘟嘟貼圖區,18成人,美女交友,85cc成人片,成人影片,免費視訊,f 罩杯美女圖片,美女交友,成人文學,aqaq 視訊聊天室,av貼圖,美女交友,ut聊天室,080視訊聊天室,視訊聊天室,ut男同志聊天室,免費交友,免費視訊聊天,成人動畫,人之初貼圖區,免費視訊,同志聊天室,ut聊天室,成人視訊,交友聊天室,尼克成人,成人動漫,交友戀愛小站,免費交友

Anonymous said...

外表往往與事實本身不符,世人卻容易被表面裝飾所欺騙了..................................................

Anonymous said...

thanks you share..................................................

Anonymous said...

每個人生命中都可能遇到貴人,這些貴人不一定真的尊貴,他可能是陌生人,也可能是你的敵人。..................................................

Anonymous said...

Tuneful well-mannered post. I honest stumbled upon your blog and wanted to say that I have exceedingly enjoyed reading your blog posts. Any conduct I' ll be subscribing to your maintain and I fancy you record again soon.
[IMG]http://www.sedonarapidweightloss.com/weightloss-diet/34/b/happy.gif[/IMG]
[img]http://www.cpcstorm.com/co/images/6.gif[/img]
[img]http://www.cpcstorm.com/co/images/7.gif[/img]
[img]http://www.cpcstorm.com/co/images/8.gif[/img]
[img]http://www.cpcstorm.com/co/images/9.gif[/img]
[img]http://www.cpcstorm.com/co/images/10.gif[/img]
[img]http://www.cpcstorm.com/co/images/11.gif[/img]
[img]http://www.cpcstorm.com/co/images/12.gif[/img]
[img]http://www.cpcstorm.com/co/images/13.gif[/img]
[img]http://www.cpcstorm.com/co/images/17.gif[/img]
[img]http://www.cpcstorm.com/co/images/18.gif[/img]