Sas

Asked • 03/26/19

How can I make a character variable equal to the formatted value of a numeric variable for arbitrary SAS formats?

If I have a numeric variable with a format, is there a way to get the formatted value as a character variable? e.g. I would like to write something like the following to print `10/06/2009` to the screen but there is no `putformatted()` function. data test; format i ddmmyy10.; i = "10JUN2009"d; run; data _null_; set test; i_formatted = putformatted(i); /* How should I write this? */ put i_formatted; run; (Obviously I can write `put(i, ddmmyy10.)`, but my code needs to work for whatever format `i` happens to have.)

1 Expert Answer

By:

Rick A. answered • 03/26/19

Tutor
5 (33)

Experienced SAS Professional

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.