Warm tip: This article is reproduced from serverfault.com, please click

Combine two strings for file path in SAS

发布于 2020-12-02 22:02:49

I have two strings that I want to combine to get the file path to be used in a PROC IMPORT statement in SAS

%let TypeName = XYZ;
%let InputDirectory = \\Nam1\Nam2\Nam3\Dataset\;
%let FileType = Filing.csv;
%let Filename = &TypeName&FileType;
%put &Filename;
%let CompInputDirect = &InputDirectory&Filename;

PROC IMPORT DATAFILE= %sysfunc(&CompInputDirect)
OUT= outdata
DBMS=csv
REPLACE;
GETNAMES=YES;
RUN;

I get an error message saying that

ERROR: Function name missing in %SYSFUNC or %QSYSFUNC macro function reference.  

How do I put a macro variable containing the full file path in the Proc Import statement? Thanks in advance.

Questioner
cordelia
Viewed
0
data _null_ 2020-12-03 06:36:19

I reckon you meant to use QUOTE function.

%sysfunc(quote(&CompInputDirect))

Or you can supply your own quotes.

"&CompInputDirect"