/* 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-
*/
Navigate AI governance with SAS tools for compliance and ethical AI practices. Try SAS Ai Navigator for free for the first six months.
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.
Ready to level-up your skills? Choose your own adventure.