BookmarkSubscribeRSS Feed
Peter_C
Rhodochrosite | Level 12
well I was

struggling to recognise quote characters in macro

I just couldn't seem to make the example in the online doc work for me
..
..
..
..
step back a little
..
..
..
rather than test a single quote

which is what is causing me trouble
..

,..
(a light started to blink on.. )
..
I remembered the base SAS dequote() function

It strips of pairs of quotes without needing me to use that symbol 🙂

this worked for me[pre]
%if %sysfunc(dequote(&memname)) EQ &memname %then %do ;
%* it is not quoted so get on with it ! ;
2 REPLIES 2
chang_y_chung_hotmail_com
Obsidian | Level 7
I went through a similar struggle. Mine was making a macro so that it can accept a date literal both with the quotes and trailing d and without. My solution was using prx shown on sas-l. See the macro %date2num():
http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1007A&L=sas-l&P=R1001
Robert_Bardos
Fluorite | Level 6
Ditto. In my case it was a macro that served as a dynamic allocation front-end on the mainframe. The coder's intent was to support MVS datasetnames to be passed with either single or double quotes. Jumping through SUBSTR hoops he had been able to come up with a double quoted macro variable value. Fine for SAS 8.2 where he had developed it, but fraught with WARNINGs/NOTEs with SAS 9.1.3 which turned out to be a little pickier about the doubled double quotes that sometimes ended the variable's value.

Replacing all the SUBSTR logic with DEQUOTEs made the code cleaner and easier to read, the WARNINGs/NOTEs go away and so ultimately the SAS log much cleaner.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 798 views
  • 0 likes
  • 3 in conversation