Date: Fri, 19 Dec 1997 16:48:00 +0100 From: "Stuerzl, Heinr.,DE,Diagnostics" Subject: SASTip: Macro UNISTATS (final version) I'm pleased to present the final version of the macro UNISTATS which is able to substitute PROC UNIVARIATE (apart of it's plot function and special percentiles). UNISTATS calculates for a given set of variables every univariate statistic (especially the MEDIAN) which can be performed with PROC UNIVARIATE but outputs them like PROC MEANS (one row per variable). An output data set is automatically written which contains the statistic keywords as labeled variable names, the name of the investigated variable and the By-variables if used. UNISTATS is quick and easy to use because of it's naming conventions. You can name variables like you would do in defining an array e.g. x1-x10, a--z, abc:, _numeric_ UNISTATS is a real child of SAS-L. It was developed in September and October 1997 by Ian Whitlock (whitloi1@westat.com) and VITRAI Jozsef (h12388vit@ella.hu) via SAS-L. Michael Friendly (friendly@hotspur.psych.yorku.ca) gave the idea to support special variable lists like x1-x10, a--z, abc:, _numeric_. Here is a final version with Where-clause, By-processing and improved performance speed. Heinrich Stuerzl Data Management & Biostatistics Behring Diagnostics GmbH, Marburg, Germany eMail:stuerzl@msmbwma.hoechst.com _________ Examples: data temp; do i=1 to 1000; group=mod(i,2); x=normal(-1); x1=x; y=normal(-1); x2=y; z=normal(-1); if mod(i, 100)=0 then x=.; output; end; run; title2 "UNISTATS TEST"; %unistats (data=temp, vars=_numeric_, stats=n median mean min max); %unistats (data=temp, vars=x: , stats=_all_); %unistats (data=temp, by=group, vars=x1-x2 , stats=); %unistats (data=temp, where=i<=5, by=i, vars=x--z, stats=n); /*-------------------------------------------------------------------- DATA Input data set, if none _LAST_ is used VARS List of (numeric) variables (max. 999) Special lists possible like x1-x12, x--z, abc: _numeric_ WHERE Where clause BY By-variables (a temporary copy of the input data set will be sorted if necessary) STATS Statistics keywords of PROC UNIVARIATE or _all_ Statistics are output in the given order N NOBS NMISS SUM MEDIAN MEAN VAR STD CV MIN MAX Q1 Q3 P1 P5 P10 P90 P95 P99 NORMAL PROBN T PROBT MSIGN PROBM SIGNRANK PROBS STDMEAN USS CSS SKEWNESS KURTOSIS SUMWGT RANGE QRANGE MODE Default: N MEDIAN MEAN STD CV MIN MAX Note: Other percentiles can't be calculated use PROC UNIVARIATE with PCTLPTS= PCTLPRE= ... OUT Output data set (Default: WORK.STAT1) Contains one obsservation per variable (max. 999) and the name of the variable in VNAME labeled "Name". Output data set contains for each statistic a variable named according to the keyword. And By-variables if used. PRINT Y - Standard output with PROC PRINT with (Default) N - no output Note: UNISTATS needs 6.11 TS040 or higher (because of %sysfunc). --------------------------------------------------------------------*/