Friday, April 1, 2011

How to preserve leading zeros when export to csv file

data one;
input id $;

/* create formatting to preserve leading zeros in excel */
cid  =  ' = " '  ||  id  ||  ' " ';

cards;
00123
12398
01234
00034
;
run;

data one (drop=id);
      set one;
run;

ods listing close;

ods csv file='lead0.csv' ;

      proc print data=one noobs;
      run;

ods csv close;