05-17-2012 08:57 AM
one do one end .....is there something else needed to close this do block?
merge output.da_med (in=in1) output.da_rx (in=in2); *merge the ones and zeroes produced by CDPS and MRX above;
if _n_ = 1 then set weight_dac; *insert the weights on every record;
aidcat = 'DA';
%bridge; *run the bridge code macro;
*set up arrays to facilitate multiplication of a large list of variables;
risk_score = intercept_fac; *intercept must be added to every risk score;
do i = 1 to dim(fac);
*cycle through all the 1/0s and factors, multiply them together, and add them to the risk score field;
risk_score = risk_score + ind * fac;
drop intercept_fac &factors. i CCARVH_fac CCARM_fac CCNSH_fac CPULVH_fac CPULH_fac CGIH_fac CMETH_fac CHIVM_fac
CINFM_fac CHEMEH_fac aid;
05-17-2012 02:42 PM
Great, so somewhere in %bridge, there is an unclosed do block.
Your task is then to go through %bridge and figure out where this unclosed do block is.
05-18-2012 08:08 AM
ok, that is what I am asking about...I can't find it....I think I have matched up all of the do and ends.....am I matching up the wrong things......I thought a do block started with 'do' and ended with 'end'
05-18-2012 08:24 AM
What about the code for the other macro you call? You didn't include it? Also, when you call a macro, the line shouldn't end with a semicolon.
Yes, your understanding is correct.
05-18-2012 02:02 PM
If you're absolutely stuck and can't find the end to match a do, start numbering them.
do start=1 to 20; /*1*/
do test=1 to 50; /*2*/
some more code...;
05-21-2012 01:17 PM
If you have SAS Enterprise Guide 4.3 or 5.1, you might try running this (and the macros that it references) through the code formatter:
05-20-2012 08:09 PM
The lines in that file are way too long for human consumption.
And SAS might even have trouble with them depending on the version you are using and the settings.
I suspect that some lines are being truncated.
Especially because the %BRIDGE macro has a couple of END statements out past column 165!!!!
05-21-2012 07:45 AM
I agree with Tom
While the problem may or may not be in %Bridge, the way things are written, in one long line "way too long for human consumption", the appearance of the code hinders debugging and understanding. This code ought to be one command per line, and properly indented. My eyes are not used to looking at code written like this, it hurts my brain to look at code written like this, and so even though I was being unhelpful, I didn't even try to see if I could find a problem in this code.
05-17-2012 02:11 PM
Run the code with OPTIONS MPRINT to see if there's anothe DO block in any of your macros.
BTW, becareful habitually ending references to macro variables with a period when you aren't actually concatenating something.
05-18-2012 05:10 PM
I ran a piece of code using 1 for the value of all of the variables and only the BRIDGE macro as shown in your attachment and did not get any message about unclosed do loop (see code at bottom).
At this point point I would start with the offending datastep and comment out all the statements and the add them back in one at a time (with loops the start and end count as one statement for this process - but do run with the stuff inside the loops commented out).
I would also make sure the other macros CDPS and MRX do not contain definitions of or modify the BRIDGE macro.
Retain &list &factors 1;
aidcat = 'DA';