What is "&Filepath"?

Reply
Occasional Contributor
Posts: 7

What is "&Filepath"?

Hi,

I am trying to work out how the below macro works and cannot understand how this line ( DATAFILE="&FilePath") in the code works, Filepath is not defined anywhere earlier, &Library is defined.

%MACRO ABC_ImportMacro(FilePath,Date);

PROC IMPORT

    DATAFILE="&FilePath"

        OUT=&Library..ABC_Raw_&Date

        REPLACE

        DBMS = XLS;

    SHEET = "Template";

  NAMEROW = 5;

  STARTROW = 6;

RUN;

%MEND;

Can some one tell me what does "&Filepath" do (points to this file i guess) but how?

Many thanks,

Stan

Super Contributor
Posts: 297

Re: What is "&Filepath"?

Hi Stan,

Effectively the FilePath macro variable is created in the line %MACRO ABC_ImportMacro(FilePath,Date);. 


The data contained within this macro is defined when you call the macro using %ABC_IMPORT(<Filepath>,<Date>), where the information in the angle brackets is defined by the user or another program.

Do you know where you call this Macro from?

Regards,

Scott

Edited to reflect the correct call of macro.

Super User
Super User
Posts: 7,977

Re: What is "&Filepath"?

Use

options mlogic mprint symbolgen;

This turns on all the macro debug information and in that it will tell you what macro variables decode to at run time.

I would also suggest reading up on macro programming in the SAS documentation to have a full understanding of what is being done.

Ask a Question
Discussion stats
  • 2 replies
  • 209 views
  • 0 likes
  • 3 in conversation