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?