简体   繁体   中英

What does “%” in front of the variable in SAS pass-through exactly do / or means ?

what exactly does "%" in pass through means ? I got this code from others, the code works fine but I just don't understand why would have to put % in front of the variables. If it's a %macro I don't see any macro code in library. Any explanation would help

proc sql;
  connect to odbc as d(datasrc=source);
  create table out as select * from connection to d
  (
    select
      t.id,t.rule_id,
      %application_id,
      t.date,
      %dpv, %dpvfn1, %dpvfn2, %dpvfn3,
      %AddressValid,%AddressValidMsg,%AddressType,    
      from &db2 t
      join &db3 dxs on t.id=dxs.id
 left join &db4 dxr on t.id=dxr.id
  );
  disconnect from d;
quit;

%MACRO X; VAR %MEND;

The above example is a definition of a macro.

In your question, all the columns with % are actually doing macro calls and replacing the calls with the values present in their macro definitions.For eg in ur select query...

select
      t.id,t.rule_id,
      %application_id,
      t.date,
      %dpv, %dpvfn1, %dpvfn2, %dpvfn3,
      %AddressValid,%AddressValidMsg,%AddressType,    
      from &db2 t
      join &db3 dxs on t.id=dxs.id
 left join &db4 dxr on t.id=dxr.id

%application_id,%dpv, %dpvfn1, %dpvfn2, %dpvfn3,%AddressValid,%AddressValidMsg,%AddressType

All these above macro calls will retrieve their corresponding definitions and replace them in the place of your select columns...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM