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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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