proc append base=dsn1 data=dsn2;

run;

https://support.sas.com/resources/papers/proceedings/pdfs/sgf2008/085-2008.pdf

Skip to content
# Category: SAS data editing

## SAS PROC APPENDIX

## Ascending and decending

## SAS PROC EXPORT

## How to convert an ACCESS database into SAS files

## Suppress graphic printing in SAS

## T-test in SAS datastep

## Derive AGE off Date of Birth in SAS

## How to QC the result of random assignment

## Counting how many times does a string occur in a variable

## Creating Sequence Values per ID

proc append base=dsn1 data=dsn2;

run;

https://support.sas.com/resources/papers/proceedings/pdfs/sgf2008/085-2008.pdf

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>

%let excelname="C:\ ... \temp.xlsx";

PROC EXPORT DATA=kazmean1 OUTFILE= "&excelname"

DBMS=xlsx REPLACE;

sheet="T13";

RUN;

This creates a library in which you will find all tables in the Access database.

libname johnwayne pcfiles path="C:\temp\this_is_access_data.accdb";

You will find a library (johnwayne in this example) in the SAS-Explorer window.

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.

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;

libname kaz "...";

data a;

set kaz.Query;

FORMAT fixed_date date9. ;

fixed_date=mdy(10,20,2016);

AGE=INT((fixed_date-Final_DOB)/365);

keep age FINAL_DOB;

run;

QC 1:

Check the number of cases within each group (i.e. treatment and control group).

Q2:

Check if the number of treatment school and control school is balanced within block.

COUNTING=count(award_info,"SP");

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002260230.htm