DATA Step, Macro, Functions and more

Resolving a macro variable inside of proc format

Reply
Super Contributor
Posts: 291

Resolving a macro variable inside of proc format

My code:

proc format;

value &mkt

other="%nrstr(&custname);

run;

This does not resolve to the intended name but remains as &custname.  Can anyone help?

Thank you,

Bill

Contributor
Posts: 29

Resolving a macro variable inside of proc format

It would be nice to see the log to know more about your program.

You only have one double quote.

Try  other="%nrstr(&custname)";

or

other=%nrstr("&custname");

to force it to resolve.

Super Contributor
Posts: 291

Re: Resolving a macro variable inside of proc format

Sorry, typing error on my part.  I did have

other="%nrstr(&custname)";

The log show no errors.

393 %macro fmt;

395 value $mkt

396 other="%nrstr(&CustName)";

397 run;

398 %mend fmt;

399 %fmt;

NOTE: Format $MKT has been output.

Other placements of the quotes did not help either.

394 proc format;

Super User
Posts: 19,800

Resolving a macro variable inside of proc format

We'd need to see what the &mkt macro variable does resolve to to help out.

If you're trying to create a format and have the data somewhere else consider using CNTLIN option instead of a macro variable.  CNTLIN option allows you to create a format from a dataset.

Super Contributor
Posts: 291

Re: Resolving a macro variable inside of proc format

Thanks for the cntlin idea.  I hadn't thought of using it in this context.  I want with the following:

data Customer;

fmtname='$mkt';

start='other';

label="&custname";

run;

proc format cntlin=Customer;

run;

Ask a Question
Discussion stats
  • 4 replies
  • 590 views
  • 6 likes
  • 3 in conversation