Ascending and decending

In programming, sorting can occur in ascending way or ascending way. I often get confused by this distinction when  I use SAS PROC SORT.   To summarize:

Sorting by ascending order means:
1
2
3
4
5

Sorting by descending order means:
5
4
3
2
1

PROC SORT:

The following is an example of how descending can be specified. The first SORT procedure sorts the data by first DateModified by natural sequence and TimeModified by the descending order. This means that older data (defined by TimeModified) in the presence of duplicate rows (the same date) will appear first. The second SORT procedure has the nodupkey option, which means that only the first and thus oldest data will be kept and the rest are deleted if the data came from the same date.

proc sort;by Table1_ID child_number DateModified descending TimeModified;
run;
proc sort nodupkey;by Table1_ID child_number;
run;

 

PROC LOGISTIC

It is common to code the binary outcome as 0 (failure) and 1 (success); however, PROC LOGISTIC models the occurrence of 1 not 0.

<continued>

Suppress graphic printing in SAS

SAS prints graphics by default.  This can be suppressed by:

ods graphics off;

To suppress printing specifically of PROC REG, add the following to the PROC REG  statement:

PLOT(MAXPOINTS=NONE)

 

Official examplanation:

MAXPOINTS=NONE | max <heat-max>

suppresses most plots that require processing more than max points. When the number of points exceeds max but does not exceed heat-max divided by the number of independent variables, heat maps are displayed instead of scatter plots for the fit and residual plots. All other plots are suppressed when the number of points exceeds max. The default is MAXPOINTS=5000 150000. These cutoffs are ignored if you specify MAXPOINTS=NONE.

Thanks MM.

T-test in SAS datastep

The following SAS datastep conducts a test using functions in a datastep.

proc means data=both STACKODSOUTPUT n mean std min max stderr ;
class treat ;
var

<Variables here>

;
ods output summary=kaz2;
run;

data c;set kaz2;
if treat=0;
N_c=N;
mean_c=mean;
StdDev_c=StdDev;
Min_C=Min;
Max_C=Max;
StdErr_C=StdErr;
keep N_C MEAN_C StdDev_c MIN_C MAX_C StdErr_C Variable label;
run;

data t;set kaz2;
if treat=1;
N_t=N;
mean_t=mean;
StdDev_t=StdDev;
Min_t=Min;
Max_t=Max;
StdErr_t=StdErr;
Variable_QC=Variable;
keep N_T MEAN_T StdDev_t MIN_T MAX_T Variable_QC StdErr_t;
run;

data merge_CT;
merge C T ;
difference=MEAN_T-MEAN_C;

/*https://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm*/
POOLED_SE=sqrt( ( (StdDev_t*StdDev_t) / N_T ) + ( (StdDev_c*StdDev_c ) / N_C ) );

T_value=abs(difference)/POOLED_SE;

P_value=(1-probnorm(T_value))*2;
*if P_value < 0.1 then sig="t";
if P_value < 0.05 then sig="* ";
if P_value < 0.01 then sig="** ";
if P_value < 0.001 then sig="***";
if P_value =. then sig="";

run;