/* 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-
*/
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.