BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have a sample program like below..

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

data work;
set sasdata2.STATE_EXTRACT;
run;

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

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

ODS CSV CLOSE;


-----------------------------------------------------------------------------------------------

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,
Neel
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1 reply
  • 652 views
  • 0 likes
  • 2 in conversation