How to preserve leading zeros when export to csv file

This post was kindly contributed by SAS & Statistics - go there to comment and to read the full post.

data one;
input id $;

/* create formatting to preserve leading zeros in excel */
cid&nbsp =&nbsp ‘&nbsp=&nbsp”&nbsp’&nbsp ||&nbsp id&nbsp ||&nbsp ‘&nbsp”&nbsp’;

cards;
00123
12398
01234
00034
;
run;

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

ods listing close;

ods csv file=’lead0.csv’ ;

&nbsp &nbsp &nbsp proc print data=one noobs;
&nbsp &nbsp &nbsp run;

ods csv close;

This post was kindly contributed by SAS & Statistics - go there to comment and to read the full post.