BookmarkSubscribeRSS Feed
Question
Fluorite | Level 6

Hi All,

I have a list of items purchased, and they have characters like & or % , but I would like to replace them by Perc or And For example...It's because I am running a macro and I am getting the following warning. Your help would be much appreciated. Many Thanks

WARNING: Apparent invocation of macro XF not resolved.

WARNING: Apparent symbolic reference PEA12X1L not resolved.

WARNING: Apparent symbolic reference CRAN8X180G not resolved.

DESCRIPTION
TYP/BGS 8X80'S+50% XF
WEL W GRP&PEA 12X1L
WENS & CRAN 8X180G
4 REPLIES 4
allurai0412
Fluorite | Level 6

hi ,

Compress() function will delte the required characters

Tranwrd() replaces the words ..

please try.....

data want;
   input description $ 32.;

  /* new_description1 = compress(description,'%,&'); for deleing only*/
  description=tranwrd(description,'%','Percentage');
  description=tranwrd(description,'&','And');
   datalines;
   TYP/BGS 8X80'S+50% XF
   WEL W GRP&PEA 12X1
   WENS & CRAN 8X180G
   ;
   run;

Regards

Allu

UrvishShah
Fluorite | Level 6

If you want to replace "&" and "%" with Per and AND only because you get the warning message by invoking your macro then i think rather than replacing them you can use Macro Quoting Function to mask the Macro Language Elements if it is set to your business requirement...

%let DESCRIPTION = %nrstr(TYP/BGS 8X80'S+50% XF);

It will intrepreate as text rather than Macro language elements...

-Urvish

Question
Fluorite | Level 6

Many Thanks Urvish! I think you are right, I should not replace it!Smiley Happy

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
  • 786 views
  • 0 likes
  • 3 in conversation