BookmarkSubscribeRSS Feed
deleted_user
Not applicable
i have aimport code how can i keep it in macro and reuse it the code is here now i want to change the outfile and datafile only by using macro.


PROC IMPORT OUT= WORK.ASd
DATAFILE= "C:\Documents and Settings\Ma
r\dq_sample.xls"
DBMS=EXCEL5 REPLACE;
GETNAMES=YES;
RUN;
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Macros are executed, optionally with macro variable substition on the command line. Then, the macro variable reference is made using a &varname, as shown below:

%MACRO MYMACRO(MYVAR);
%PUT MYVAR IS SUBSTITUTED AS: &MYVAR;
%MEND MYMACRO;
%MYMACRO(some_value);

Refer to the SAS Macro Language documentation at the SAS support website http://support.sas.com/ and the DOC web page:

http://support.sas.com/documentation/onlinedoc/91pdf/index.html


http://support.sas.com/onlinedoc/913/getDoc/en/mcrolref.hlp/a002293969.htm


Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
%macro import(output=,path=);
PROC IMPORT OUT= &output
DATAFILE= "&path"
DBMS=DLM REPLACE;
DELIMITER='7C'x;
GETNAMES=YES;
DATAROW=2;
RUN;
%mend;

%import(output=ss,path=C:\SAM\DQ\Data\SQL Data\CITY_PIN3.txt);

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1236 views
  • 0 likes
  • 2 in conversation