Search notes:

SAS programming, function putn

putn allows to convert a numeric value to a character value with a dynamic format. In contrast, the format of the put statement must be specified at compile time.
data _null_;

   num_days_since_jan_1st_1960 = 15;

/* Convert the numeric value num_days_since_jan_1st_1960
   to a character with width=11.
   Since num_days_since_jan_1st_1960 is a numeric, we
   use putn (rather than putc) */
   format_ = 'date';
   width   = 11;
   
   dt = putn(num_days_since_jan_1st_1960, format_, width);
   put dt=;

   dt_type = vtype(dt);
   put dt_type=;

run;
Github repository about-SAS, path: /programming/functions/putn.sas

See also

%sysfunc(putn…))
functions

Index