/* test data */
data one;
input var $ @@;
cards;
12+ -10 50+ -1 -45 300+ 0 .a . 234567 0.123+
;
run;
proc format;
picture trailsgn(default=6)
low-<0='00000-'
0<-high='00000+';
run;
data two;
set one;
num = input(var, trailsgn.);
format num trailsgn.;
run;
/* check */
proc print data=two;
run;
/* on list
Obs var num
1 12+ 12+
2 -10 10-
3 50+ 50+
4 -1 1-
5 -45 45-
6 300+ 300+
7 0 0
8 .a A
9 .
10 234567 34567+
11 0.123+
*/
/* tail sign format by art297 */
proc format;
picture sgn
low-<0 = "0000000000.00-"
0-high = "0000000000.00+";
run;
/* ouch! */
data _null_;
v = -0.12;
put v= :sgn8.;
run;
/* on log
v=12-
*/
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.