BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ZRick
Obsidian | Level 7

why this marco doesn't work:

%macro t(var=);

proc sql;

select name into: name from sashelp.class where name='&var.';

quit;

%put _user_;

%mend;

%t(var=Henry);


what is wrong with my single quotation mark?



1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Macro language references are not expanded when enclosed in single quote marks. Use double quote character instead.

name = "&var"

View solution in original post

5 REPLIES 5
Tom
Super User Tom
Super User

Macro language references are not expanded when enclosed in single quote marks. Use double quote character instead.

name = "&var"

ZRick
Obsidian | Level 7

is this the only main difference when choosing to use single or double quotation?

I always thought single/double quotation can be used interchangeably.

Haikuo
Onyx | Level 15

Good topic for a SUG paper. Their differences seem to be more than just that. Especially when you refer Windows path ( X command, etc) or using SQL pass-thru ( well, to be fair, that is NOT a difference within SAS).

Haikuo

ZRick
Obsidian | Level 7

Is it safe to say that double quote is more generic than single quote in passing macro variables?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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