/* 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-
*/
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.