BookmarkSubscribeRSS Feed
metallon
Pyrite | Level 9

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 ;

...

7 REPLIES 7
RW9
Diamond | Level 26 RW9
Diamond | Level 26

At a guess:

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

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

metallon
Pyrite | Level 9

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

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

metallon
Pyrite | Level 9

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.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

metallon
Pyrite | Level 9

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

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 2085 views
  • 6 likes
  • 2 in conversation