—•Today is •—

The structure of a data set when using the BY statement does not always guarantee that PROC TRANSPOSE will create an output data set with one record per BY group. For some cases it is important to use a BY variable that is unique for every record (however, if one does not already exist in the data set you can use _N_), and then transpose the data set a second time.

To keep the implied ID variable _NAME_ from causing errors, in the second step eliminate it using the drop= data set option.


  proc transpose data=admr0017.dcis05 out=test1;
    by memkey;
    copy sex payer;
    var numercnt;
  run;
      
  data catalyst.dcis05_all (drop=_name_ _label_
                          rename=(col1=NUMERCNT_1 col2=NUMERCNT_2
                                  col3=NUMERCNT_3 col4=NUMERCNT_4
                                  col5=NUMERCNT_5 col6=NUMERCNT_6
                                  col7=NUMERCNT_7 col8=NUMERCNT_8));
    set test1;
    length MEMBERID $11 LOB $2;
      if missing(col1 - col8)
        then delete;
  run;
				

Print Document

Copyright © 2006 www.nycinformatics®.com All Rights Reserved
Last edited on: May 28, 2006
SAS product or service names are registered trademarks of SAS Institute, Inc. in the USA and other countries.
® indicates USA registration.