BookmarkSubscribeRSS Feed
2 REPLIES 2
Shmuel
Garnet | Level 18

In order to use dynamic format, given at run time, use PUTN for numeric or PUTC for character instead of PUT function.

for example:

data test;
  x=2.5;
run;

data _null_;
 set test;
     myfmt = 'z4.3';
     show = putn(x,myfmt);  /* using variable name not a format name */
     put show=;
run;

you can create your own format in a variable by using concatenation and any expression you need.

Hello_there
Lapis Lazuli | Level 10

Thanks, this information was helpful. I had deleted the original post bc i thought it was probably confusing. But using the putn() helps me w/ what i was looking for. If i was able to, i would have accepted this as a solution. Thanks again!

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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 lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 836 views
  • 1 like
  • 2 in conversation