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);

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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