Help using Base SAS procedures

macro syntax

Not applicable
Posts: 0

macro syntax

I have a sample program like below..

libname sasdata2 'C:\DAG\SAS\Tests\';

data work;
set sasdata2.STATE_EXTRACT;

ODS CSV FILE = 'C:\DAG\SAS\Tests\CSV Files\Test1.csv';

proc sql;
select * from dictionary.tables where memname='STATE_EXTRACT';



I want to convert the above to a macro with the places in bold replaced by macro arguments. Is this possible? especially the second higlighted text I'm not able to get what the syntax would be with macro arguments.

the line sasdata2.STATE_EXTRACT

Any help please?..

Thanks & Regards,
Super Contributor
Super Contributor
Posts: 3,176

Re: macro syntax

Posted in reply to deleted_user
These points were mentioned and offered guidance in your other active post. Your PROC SQL invocation needs to be syntactically correct if you want to generate SAS macro variables to use within a macro execution. Or a DATA step approach is possible also, as was mentioned, using the CALL SYMPUT technique to register a SAS global macro variable. Along with that, you must define your SAS macro with the macro variable (symbolic - using an ampersand) reference so that SAS will resolve them at compilation time. To execute the macro with macro variables passed, you must specify them on the %MACRO statement as (macro_var_parameters); -- within the parentheses.

Short of what's already been offered (and there may be some to do the coding for you), it's time to get the DOC out and learn about SAS MACRO language programming, one step at a time.

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation