University of Rochester Medical Center
SearchDirectoryNewsEventsStrong HealthURMC Home

SAS Helpful Hints

Biostat Macro Library

Data manipulation tools: Deltas and Transpose.

%Deltas and %Transpose reside in the departments SAS Macro Library and are enabled with the following SAS statements:

Libname biostat '\\BIO2\example\SASMacrosWindows';
Options Mstored SasMstore=biostat;

%Deltas returns a dataset with the changes from baseline on a list of outcome variables.

Syntax:
%Deltas(datain,dataout,who,keep,visit,baseline,varlist);
    datain:      Dataset to use.
    dataout:   Output dataset..
    who:        Subject ID.
    keep:       List of variables to keep.
    visit:         Time variable: visit, week, month.(Numeric)
    baseline:   Baseline visit(Numeric Constant).
    varlist:      List of variables.(Numeric)

Example:
%Deltas(work.a,work.new,id,treatment site,week,0,A B C D E);


%Transpose returns a dataset with the list of outcome variables transposed into a single column, "_result". An indicator column, "_scale", is created and formatted with the labels from the original variables to specify the transposed measure. This is very useful for creating a by variable before calling a SAS procedure. Instead of calling the same procedure once for each outcome measure, call the procedure once with the "by _scale;" statement. The same results are created in a fraction of the time.

Syntax:
%Transpose(datain,dataout,who,keep,visit,varlist);
    datain:      Dataset to use.
    dataout:   Output dataset..
    who:        Subject ID.
    keep:       List of variables to keep.
    visit:         Time variable: visit, week, month.(Numeric)
    varlist:      List of variables.(Numeric)

Example:
%Transpose(work.a,work.new,id,treatment site,week,A B C D E);

Please send your comments and suggestions about this web page to A. Watts (watts@bst.rochester.edu)