DATA Step, Macro, Functions and more

quotes for macro variable

Reply
Regular Contributor
Posts: 199

quotes for macro variable

Where do I put the quotes in order to get this macro variable (ie &date) to work?
if (daysum=. and day< *&date.*d) then daysum=0;

where * is a single quote mark.
where &date can be, for example, 15Sep10.

Thank you.
PROC Star
Posts: 7,471

Re: quotes for macro variable

Have you tried it with double quotes?

Art
Super Contributor
Super Contributor
Posts: 3,174

Re: quotes for macro variable

When using macro variables coded as literal constants/data-strings with DATA/PROC code, double-quotes are required for proper resolution. Also, when debugging your program, code the OPTIONS SYMBOLGEN, also consider this coding for debugging macros and macro variables:

OPTIONS SOURCE SOURCE2 MACROGEN SYMBOLGEN MPRINT;

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

macro variable intro site:sas.com
Regular Contributor
Posts: 199

Re: quotes for macro variable

Double quotes worked.
For what ever reason they didn't work the first time I tried.
Thanks.
SAS Employee
Posts: 58

Re: quotes for macro variable

With macros, use double quotes. The SAS Macro Facility will not look inside of single quotes.
Regular Contributor
Posts: 241

Re: quotes for macro variable

> With macros, use double quotes. The SAS Macro
> Facility will not look inside of single quotes.


Technically, this is too sweeping a statement. You cannot really say that Macro *never* look inside of single quotes as shown on the thread started with this sas-l posting.

Ask a Question
Discussion stats
  • 5 replies
  • 153 views
  • 0 likes
  • 5 in conversation