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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register 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.

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
  • 651 views
  • 0 likes
  • 2 in conversation