one do one end .....is there something else needed to close this do block?
data da;
merge output.da_med (in=in1) output.da_rx (in=in2); *merge the ones and zeroes produced by CDPS and MRX above;
by recipno;
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;
array ind
array fac
CINFM_fac CHEMEH_fac;
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;
end;
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;
run;
Thx
We can't provide an answer, you haven't shown us what is in %bridge
Here is the full code-thank you for your efforts...
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.
Agreed with PaigeMiller, I think in the last line of Bridge some problem is there.
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'
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.
THx, I will check it again
If you're absolutely stuck and can't find the end to match a do, start numbering them.
do start=1 to 20; /*1*/
some code...;
do test=1 to 50; /*2*/
some more code...;
end ;/*2*/
end;/*1*/
that is a great idea! thx
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:
http://blogs.sas.com/content/sasdummy/2010/12/23/the-sas-code-formatter-more-than-a-pretty-face/
Chris
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!!!!
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.
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.
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.
data junk;
Retain &list &factors 1;
aidcat = 'DA';
%bridge
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.