Transdata™ - join

 

Join input data used in transformation for final output data

%join (indata = input data set,       
              outdata = output data set,
              outlabel = output label,        
              keys
= key variables,
              dropmis = drop missing values,      
              type = join type,
              output = output program);


Where Is Type... And represents...
indata C Source data set to be converted.  This is specified with a two level dot notation: libname.dataname.  Multiple datasets will be separated by spaces.
outdata C Destination data set.  This is specified with a two level dot notation: libname.dataname.  
outlabel C (optional) Output dataset label name.
keys C Key variables separated by spaces.
dropmis C (optional) After the data is appended or merged, there may be many missing rows that can be dropped.  This can contain a variable name or a list of variables separated by spaces.  If all the values of the specified fields are missing, the row will be deleted.  This is with the exception that the current row is the only row for the key field(s). 
type C (optional) Data joining type.  This includes:
  • append (default)
  • merge
output C (optional) Name of the output SAS program.  This contains the name of the SAS program that contains the logic of the program.  If this were left blank, the program will be saved to the current directory with the name join.sas.

Details
The data join utility will "join" data sets specified into a specified destination data.  This is commonly used for data transformed by various transformation models including custom transformations.  The default append join type feature will append data in the following way.

 
INDATA1     INDATA2  
var1 var2   var1 var3
value1 value2   value3 value4
value3 value4   value4 value5
       
OUTDATA      
var1 var2 var3    
value1 value2      
value3 value4      
value3   value4    
value4   value5    

If the type is set to "merge" the result would look like:

 
INDATA1     INDATA2  
var1 var2   var1 var3
value1 value2   value3 value4
value3 value4   value4 value5
       
OUTDATA      
var1 var2 var3    
value1 value2      
value3 value4 value4    
value4   value5    

Note that in a one to many relationships, the values will be repeated.  The utility will create a warning message in a many to many join but the data will be merged with duplicates retained.

In addition to creating a base code program which produces the join, an optional code will be created to reverse the join to re-produce the original dataset before the merge.  One extra reverse index dataset will be created to track which dataset the reverse join will be located.

Example

%join (indata = inlib.adverse inlib.ae2,
              outdata =
outlib.ae ,
              key = usubjid,
              output =
c:\temp\test.sas);
 
    Transdata - ETL CDISC Software,  Meta-Xceed Inc.© 2009
Bookmark and Share