mirror of
https://github.com/yabwon/SAS_PACKAGES.git
synced 2026-01-03 21:30:06 +00:00
43 lines
1.1 KiB
SAS
43 lines
1.1 KiB
SAS
/*** HELP START ***/
|
|
|
|
/* >>> dsSQL() function: <<<
|
|
*
|
|
* Internal function called by %SQL() macro.
|
|
* The function pass query code from the %SQL()
|
|
* macro to the %dsSQL_Inner() innternal macreo.
|
|
*
|
|
* Recommended for SAS 9.3 and higher.
|
|
* Based on paper:
|
|
* "Use the Full Power of SAS in Your Function-Style Macros"
|
|
* by Mike Rhoads, Westat, Rockville, MD
|
|
* https://support.sas.com/resources/papers/proceedings12/004-2012.pdf
|
|
*
|
|
**/
|
|
|
|
/*** HELP END ***/
|
|
|
|
proc fcmp
|
|
/*inlib = work.&packageName.fcmp*/
|
|
outlib = work.&packageName.fcmp.package
|
|
;
|
|
function dsSQL(unique_index_2, query $) $ 41;
|
|
length
|
|
query query_arg $ 32000 /* max query length */
|
|
viewname $ 41
|
|
;
|
|
query_arg = dequote(query);
|
|
rc = run_macro('dsSQL_Inner' /* <-- inner macro */
|
|
,unique_index_2
|
|
,query_arg
|
|
,viewname
|
|
);
|
|
if rc = 0 then return(trim(viewname));
|
|
else
|
|
do;
|
|
put 'ERROR:[function dsSQL] A problem with the dsSQL() function';
|
|
return(" ");
|
|
end;
|
|
endsub;
|
|
run;
|
|
quit;
|