Can you tell me how to find out medican in the proc sql statement? I don't want to use proc means because I need to find the median of different groups which are seperated by character values. Thank youj.
I normally use the proc sql code to create a table. Then
I would use code like the following:
proc sql;
create table test as
select ........code
from .....code
where .....;
data temp;set test;
proc sort;by yourcharvariable;
PROC MEANS MEDIAN MEAN STD MIN MAX SUM MAXDEC=2 noprint;BY yourcharvariable;
VAR a b ;
output out = work.rep
Median= medA medb
mean = XA XB
min = MINA MINB
max = MAXA MAXB
sum= SUMA SUMB ;
RUN;
work.rep would then be used for any output that you may want to do...
This approach may not be desirable if you have very large file sizes but works ok for my work.
In principle you can calculate a lot of different things during a proc sql. But you can't calculate a median because this function is not available. :-(
For a means calculation you would use something like this:
proc sql;
create table summary as
select col1,
col2,
col3
mean(var1) as newcol
from oldtable
group by col1, col2, col3;
quit;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.