BookmarkSubscribeRSS Feed
edasdfasdfasdfa
Quartz | Level 8

So I notice that for csv files there are double quotes and for .txt single quotes around the path of the file in the infile statement. Why is this the case?

3 REPLIES 3
PaigeMiller
Diamond | Level 26

@edasdfasdfasdfa wrote:

So I notice that for csv files there are double quotes and for .txt single quotes around the path of the file in the infile statement. Why is this the case?


I suppose it is the whim of the programmer who did this. There's really no such rule.

 

Either single quotes or double quotes ought to work fine, except in the case where the path of the file contains a macro call or a macro variable, in which case double quotes are required.

--
Paige Miller
novinosrin
Tourmaline | Level 20

Hello @edasdfasdfasdfa   

 

Should your path contain a macro variable reference that may contain the name of the file name or something like that, you would need to enclose the path in double quotes for the reason macro variable references do not resolves within single quotes in a literal. Macro variables references do resolve within double quotes in a literal.

Reeza
Super User
  • Macro variables resolve in double quotes, not in single quotes
  • If you have an & or % in the path, SAS may think that's a macro variable/macro so you would use single quotes so it will not try to resolve the macro variable or macro. 
  • If you're using SQL pass through or X commands, you may need specific quotes - follows the rules of the SQL or OS.
  • Other than those cases, single and double quotes are usually interchangeable.

@edasdfasdfasdfa wrote:

So I notice that for csv files there are double quotes and for .txt single quotes around the path of the file in the infile statement. Why is this the case?


 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1492 views
  • 0 likes
  • 4 in conversation