BookmarkSubscribeRSS Feed
Bill
Quartz | Level 8

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

4 REPLIES 4
garybald
Calcite | Level 5

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.

Bill
Quartz | Level 8

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;

Reeza
Super User

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.

Bill
Quartz | Level 8

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;

sas-innovate-2024.png

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.

 

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
  • 4 replies
  • 1842 views
  • 6 likes
  • 3 in conversation