filename in pipe 'gunzip -c example1.txt.gz'; filename out '../example1.bin'; data in; infile in delimiter='09'X; length stattype reg site year age race sex 3; input reg site year age race sex rate se lci uci; stattype=0; /* Crude Rate */ stat=rate; if stat^=. then output; stattype=1; /* Lower CI */ stat=lci; if stat^=. then output; stattype=2; /* Upper CI */ stat=uci; if stat^=. then output; keep stattype reg site year age race sex stat; run; data in; set in; stat=stat*10000; if stat<0 then sign=1; else sign=0; num=abs(stat); num=round(num, 1); byte1=int(num/2**24); num=round(num - byte1*2**24, 1); byte1=byte1 + 2**7*sign; byte2=int(num/2**16); num=round(num - byte2*2**16, 1); byte3=int(num/2**8); num=round(num - byte3*2**8, 1); byte4=round(num, 1); run; proc sort data=in; by stattype reg site year race sex age; run; data _null_; set in; file out recfm=n; filelen=11; col=(_n_-1)*filelen+1; put @ col stattype pib1. @; col=(_n_-1)*filelen+2; put @ col reg pib1. @; col=(_n_-1)*filelen+3; put @ col site pib1. @; col=(_n_-1)*filelen+4; put @ col year pib1. @; col=(_n_-1)*filelen+5; put @ col race pib1. @; col=(_n_-1)*filelen+6; put @ col sex pib1. @; col=(_n_-1)*filelen+7; put @ col age pib1. @; col=(_n_-1)*filelen+8; put @ col byte1 pib1. @; col=(_n_-1)*filelen+9; put @ col byte2 pib1. @; col=(_n_-1)*filelen+10; put @ col byte3 pib1. @; col=(_n_-1)*filelen+11; put @ col byte4 pib1. @; run;