Hi SAS Experts,
Is there a way to display the formatted value of my prompt macro variable on the report?
I got a unformatted value of 12 and a formatted value of "December" I dont want that the user sees "12" but "December".
If I use the following I only get the 12 displayed.
proc report data=crazydata;
TITLE JUSTIFY=L &Prompt_Year ;
...
At a guess:
title justify=l "%sysfunc(put(&prompt_year.,your_format.))";
Although why have a macro variable called year which has a month?
Hi,
Thanks for the reply. I dont really have a specific format. I just want that the formatted value is shown.
"Although why have a macro variable called year which has a month?" -> because the year has 12 months
Yes, but the first question I would ask is which year then? Anyways, your choice. Good Programming Practice would indicate that giving variable names clearly identifiable names helps programming and maintaining.
As for format, you can use monname.:
OK. I think my example of picking a date/year/month prompt does not really hit the mark.
Let me draw a different picture. If I have a prompt like the following:
formatted value / unformatted value
big car______________01
small car____________002
medium car__________300
fat car_______________04
How do I now get the formatted value in my title?
proc report data=crazydata;
TITLE JUSTIFY=L &Prompt_bigCar ;
Does not work.
Sorry, what software are we using here when we talk about "prompt"? What is contained in the macro variable &Prompt_bigCar. If it is just the number 1 or text 01, then you should have a format somewhere that is used to reference it. E.g.
%let Prompt_bigCar=01;
proc format;
value car $
'01'='big car';
run;
title "%sysfunc(put(&Prompt_bigCar.,$car.))";
Hi RW9,
I am using Enterprise Guide 6.1.
I was afraid that I had to build a second mapping table in the code to map formatted to unformatted values again to just put the prompt formatted value on the report title....that is really lame.
the prompt is defined in EG like this:
formatted value / unformatted value
big car______________01
small car____________002
medium car__________300
fat car_______________04
I will let others comment on the functionality of EG, haven't used it for many years. Might help if you post the topic under the specific EG forum.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.