data want;
set test;
format z_char $5.;
/* Remove leading */
z_char=strip(put(input(strip(textchar), 5.), 5.));
/* Remove trailing */
P=findc(z_char, "0", 'K', -length(z_char));
if P then Y = substr(z_char, 1, P);
run;
... View more
Doing the selection of files in a programming environment you are familiar with makes sense, so doing it in SAS is OK.
The performance will be not as good as anything you do natively/locally (Windows shell script on the share server), but once the process is established and runs automatically in batch, this is not an issue.
... View more
This is perfect! Many of the other solutions I have tried were removing the leading zeros, the trailing zeros, all zeros, or a combination. I need something that removes only the leading zeros in a padded account number text field and then I was able to make that a numeric varialbe. The data was migrated poorly from a mainframe system to a SQL DB, so this helps a ton! Thanks so much!
... View more