Good morning NN, When I run the code you'd suggested, I get the following error messages below. Also, with filedate and termdate those should appear as date ranges. So for filedate, we would like filedate between "&filedate_min"d and "&filedate_max"d and then termdate between "&termdate_min"d and "&termdate_max"d. Stored Process Error This request completed with errors. SAS Log 1 The SAS System 07:21 Friday, February 24, 2012 NOTE: Copyright (c) 2002-2008 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) Proprietary Software 9.2 (TS2M3) Licensed to FEDERAL JUDICIAL CENTER, Site 70021403. NOTE: This session is executing on the X64_SRV08 platform. NOTE: SAS Initialization used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: The autoexec file, C:\SAS\AppDev\Lev1\SASApp\StoredProcessServer\autoexec.sas, was executed at server initialization. No server log was specified. Add the log option to the server startup command to see details of the autoexec execution (refer to "Specifying Logging Options" under "Server Startup Command" in the Server Administrator's Guide). >>> SAS Macro Variables: CIRCUIT=1 CIRCUIT_COUNT=1 DISPOSITION_COUNT=0 DISTRICT=01 DISTRICT_COUNT=1 DOCKET= FILEDATE_MAX=31Dec2009 FILEDATE_MAX_LABEL=December 31, 2009 FILEDATE_MIN=01Jan2009 FILEDATE_MIN_LABEL=January 01, 2009 NOS=130 NOS_COUNT=1 TERMDATE_MAX= TERMDATE_MIN= _APSLIST=Circuit,Circuit_count,District,District_count,Docket,Filedate_max,Filedate_max_label,Filedate_min,Filedate_min_label,Termdate_max,Termdate_min,NOS,NOS_count,Disposition_count,_odsdest,_debug,_srvport,_grafloc,_srvname,_reqmeth,_htcook,_htua,_url, _version,_rmthost,_program,_username,_rmtaddr,_result,_metaperson,_metauser,_metafolder,_client,_SECUREUSERNAME _CLIENT=StoredProcessService 9.2; JVM 1.5.0_15; Windows Vista (amd64) 6.1 _DEBUG=log _GRAFLOC=/sasweb/graph _HTCOOK=JSESSIONID=5BB6FEC2226052076BA15809BE23CACC _HTUA=Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB7.2; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729) _METAFOLDER=/Users/FJC Research/IDB/ _METAPERSON=webanon _METAUSER=webanon@saspw _ODSDEST=HTML _PROGRAM=/Users/FJC Research/IDB/IDB Civil _REPLAY="&_URL?_sessionid=E8B26711-BECE-4CA4-839E-865F0601A126&_program=replay&_entry=&_TMPCAT.." _REQMETH=GET _RESULT=STREAM _RMTADDR=169.254.95.120 _RMTHOST=169.254.95.120 _SECUREUSERNAME=webanon _SRVNAME=fjcsas.ad.fjc.dcn _SRVPORT=8080 _TMPCAT=APSWORK.TCAT01A2 _URL=/SASStoredProcess/guest _USERNAME=webanon@saspw _VERSION=Version 9.2 (Build 420) 1 options nosource source2 center notes nodate nonumber ls=195 formchar='|----|+|---+=|-/\<>*' pagesize=40 noovp nomprint nomlogic nosymbolgen; title; footnote; The SAS System NOTE: %INCLUDE (level 1) file C:\Users\amason\Stored\IDBCivil.sas is file C:\Users\amason\Stored\IDBCivil.sas. 3 +libname IDB "/res/IDB/updates"; NOTE: Libref IDB was successfully assigned as follows: Engine: V9 Physical Name: C:\res\IDB\updates 4 +run; 5 + 6 +Options mprint; 7 + 8 +%macro data(); 9 + 10 +data work.test; 11 + 12 +set idb.cv00on; 13 + 14 +WHERE _N_ > 0 15 + 16 + 17 +%if &CIRCUIT_COUNT >= 0 %then %do; 18 + 19 + AND trim(left(CIRCUIT)) IN 20 + 21 + ( 22 + 23 + %DO I = 1 %TO &CIRCUIT_COUNT; 24 + 25 + %if &i=1 %then %do;. 26 + 27 + "%trim(%left(&CIRCUIT))" 28 + 29 + %end; 30 + 31 + %else %do; 32 + 33 + "%trim(%left(&&CIRCUIT&I))" 34 + 35 + %end; 36 + The SAS System 37 + %END; 38 + 39 + ) 40 + 41 +%END; 42 + 43 + 44 +%if &DISTRICT_COUNT >= 0 %then %do; 45 + 46 + AND trim(left(DISTRICT)) IN 47 + 48 + ( 49 + 50 + %DO I = 1 %TO &DISTRICT_COUNT; 51 + 52 + %if &i=1 %then %do;. 53 + 54 + "%trim(%left(&DISTRICT))" 55 + 56 + %end; 57 + 58 + %else %do; 59 + 60 + "%trim(%left(&&DISTRICT&I))" 61 + 62 + %end; 63 + 64 + %END; 65 + 66 + ) 67 + 68 +%END; 69 + 70 + 71 +%if %length(&DOCKET) >= 0 %then %do; 72 + 73 + and DOCKET = "&DOCKET" 74 + The SAS System 75 +%end; 76 + 77 + 78 +%if %length(&FILEDATE_min) >= 0 %then %do; 79 + ERROR: Macro keyword END appears as text. A semicolon or other delimiter may be missing. 80 +and FILEDATE >= "&FILEDATE_min"d 81 + 82 +%put a 83 + 84 +%end; 85 + 86 +%if %length(&FILEDATE_MAX) >= 0 %then %do; 87 + 88 +and FILEDATE <= "&FILEDATE_max"d 89 + 90 +%end; 91 + 92 + 93 +%if %length(&termDATE_min) >= 0 %then %do; 94 + ERROR: Macro keyword END appears as text. A semicolon or other delimiter may be missing. 95 +and termDATE >= "&FILEDATE_min"d 96 + 97 +%put a 98 + 99 +%end; 100 + 101 +%if %length(&termDATE_MAX) >= 0 %then %do; 102 + 103 +and termDATE <= "&FILEDATE_max"d 104 + 105 +%end; 106 + 107 + 108 +%if &DISTRICT_COUNT >= 0 %then %do; 109 + 110 + AND trim(left(NOS)) IN The SAS System 111 + 112 + ( 113 + 114 + %DO I = 1 %TO &NOS_COUNT; 115 + 116 + %if &i=1 %then %do;. 117 + 118 + "%trim(%left(&NOS))" 119 + 120 + %end; 121 + 122 + %else %do; 123 + 124 + "%trim(%left(&&NOS&I))" 125 + 126 + %end; 127 + 128 + %END; 129 + 130 + ) 131 + 132 +%END; 133 + 134 + 135 + 136 +%if &disposition_COUNT >= 0 %then %do; 137 + 138 + AND disposition IN 139 + 140 + ( 141 + 142 + %DO I = 1 %TO &disposition_COUNT; 143 + 144 + %if &i=1 %then %do;. 145 + 146 + &disposition 147 + 148 + %end; The SAS System 149 + 150 + %else %do; 151 + 152 + ,&&disposition&I 153 + 154 + %end; 155 + 156 + %END; 157 + 158 + ) 159 + 160 +%END; 161 + 162 +; ERROR: There were 2 unclosed %DO statements. The macro DATA will not be compiled. 163 + 164 +run; WARNING: Apparent invocation of macro DATA not resolved. 165 + 166 +%mend; 167 + 168 +%data _ 180 ERROR 180-322: Statement is not valid or it is used out of proper order.
... View more