The SAS Output Delivery System and reporting techniques

SAS Prompt display formatted value on report

Reply
Frequent Contributor
Posts: 133

SAS Prompt display formatted value on report

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 ;

...

Super User
Super User
Posts: 7,392

Re: SAS Prompt display formatted value on report

At a guess:

title justify=l "%sysfunc(put(&prompt_year.,your_format.))";

Although why have a macro variable called year which has a month?

Frequent Contributor
Posts: 133

Re: SAS Prompt display formatted value on report

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 Smiley Happy

Super User
Super User
Posts: 7,392

Re: SAS Prompt display formatted value on report

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.:

SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition

Frequent Contributor
Posts: 133

Re: SAS Prompt display formatted value on report

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.

Super User
Super User
Posts: 7,392

Re: SAS Prompt display formatted value on report

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.))";

Frequent Contributor
Posts: 133

Re: SAS Prompt display formatted value on report

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

Super User
Super User
Posts: 7,392

Re: SAS Prompt display formatted value on report

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.

Ask a Question
Discussion stats
  • 7 replies
  • 848 views
  • 6 likes
  • 2 in conversation