Features: |
PROC FCMP statement CMPLIB= system option PROC FORMAT statement Function as a format feature |
proc fcmp outlib=library.functions.smd; function ctof(c) $; return(cats(((9*c)/5)+32,'F')); endsub; function ftoc(f) $; return(cats((f-32)*5/9,'C')); endsub; run;
options cmplib=(library.functions);
data _null_; f=ctof(100); put f=; run;
proc format; value ctof (default=10) other=[ctof()]; value ftoc (default=10) other=[ftoc()]; run;
data _null_; c=100; put c=ctof.; f=212; put f=ftoc.; run;
proc fcmp outlib=library.functions.smd; function ctof(c) $; return(cats(((9*c)/5)+32,'F')); endsub; function ftoc(f) $; return(cats((f-32)*5/9,'C')); endsub; run;
323 proc fcmp outlib=library.functions.smd; 324 function ctof(c) $; 325 return(cats(((9*c)/5)+32,'F')); 326 endsub; 327 328 function ftoc(f) $; 329 return(cats((f-32)*5/9,'C')); 330 endsub; 331 332 run; NOTE: Function ftoc saved to library.functions.smd. NOTE: Function ctof saved to library.functions.smd. NOTE: PROCEDURE FCMP used (Total process time): real time 17.59 seconds cpu time 1.26 seconds 333 334 options cmplib=(library.functions); 335 336 data _null_; 337 f=ctof(100); 338 put f=; 339 run; f=212F NOTE: DATA statement used (Total process time): real time 0.50 seconds cpu time 0.01 seconds 340 341 proc format; 342 value ctof (default=10) other=[ctof()]; NOTE: Format CTOF has been output. 343 value ftoc (default=10) other=[ftoc()]; NOTE: Format FTOC has been output. 344 run; NOTE: PROCEDURE FORMAT used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 345 346 data _null_; 347 c=100; 348 put c=ctof.; 349 f=212; 350 put f=ftoc.; 351 run; c=212F f=100C