Hello,
By population cohort I meant the denominator by treatment group
21461 proc sql noprint; 21462 select count(distinct subjid) into :n1-:n6 from ds2 group by trt01an; 21463 quit; NOTE: PROCEDURE SQL used (Total process time): real time 0.01 seconds cpu time 0.01 seconds
21464 %put &n1 &n2 &n3 &n4 &n5 &n6 ; 1 1 3 9 4 3
for this data step the variables need to be divided by the denominator of that particular group.
for treatment group 1 the denominator =1 . For treatment group 3 the denominator =3.
For treatment group 4 the denominator =9 etc...
I am not sure why i is getting resolved as i and not the actual number of the iteration.
data final(keep= c4-c9); length c4-c9 $20; set final2 ;
do i = 1 to 6; if mx1 not in (.,0) then c4= strip(put(mx1 ,5.)) ||" ("||strip(put(mx1 / &&n&i*100,5.1))||")"; else c4="0"; if mx2 not in (.,0) then c5= strip(put(mx2 ,5.)) ||" ("||strip(put(mx2 / &&n&i*100,5.1))||")"; else c5="0"; if mx3 not in (.,0) then c6= strip(put(mx3 ,5.)) ||" ("||strip(put(mx3 / &&n&i*100,5.1))||")"; else c6="0"; if mx4 not in (.,0) then c7= strip(put(mx4 ,5.)) ||" ("||strip(put(mx4 / &&n&i*100,5.1))||")"; else c7="0"; if mcat1 not in (.,0) then c8= strip(put(mcat1,5.))||" ("||strip(put(mcat1/&&n&i*100,5.1))||")"; else c8="0"; if mcat2 not in (.,0) then c9= strip(put(mcat2,5.))||" ("||strip(put(mcat2/&&n&i*100,5.1))||")"; else c9="0";
end;
run;
21475 21476 data final(keep= c4-c9); 21477 length c4-c9 $20; 21478 set final2 ; 21479 21480 do i = 1 to 6; 21481 21482 if mx1 not in (.,0) then c4= strip(put(mx1 ,5.)) ||" ("||strip(put(mx1 / &&n&i*100,5.1))||")"; else c4="0"; NOTE: Line generated by the macro variable "I". 1 &ni - 22 WARNING: Apparent symbolic reference NI not resolved. ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, a missing value, INPUT, PUT.
21483 if mx2 not in (.,0) then c5= strip(put(mx2 ,5.)) ||" ("||strip(put(mx2 / &&n&i*100,5.1))||")"; else c5="0"; NOTE: Line generated by the macro variable "I". 1 &ni - 22 WARNING: Apparent symbolic reference NI not resolved. ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, a missing value, INPUT, PUT.
21484 if mx3 not in (.,0) then c6= strip(put(mx3 ,5.)) ||" ("||strip(put(mx3 / &&n&i*100,5.1))||")"; else c6="0"; NOTE: Line generated by the macro variable "I". 1 &ni - 22 WARNING: Apparent symbolic reference NI not resolved. ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, a missing value, INPUT, PUT.
21485 if mx4 not in (.,0) then c7= strip(put(mx4 ,5.)) ||" ("||strip(put(mx4 / &&n&i*100,5.1))||")"; else c7="0"; NOTE: Line generated by the macro variable "I". 1 &ni - 22 WARNING: Apparent symbolic reference NI not resolved. ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, a missing value, INPUT, PUT.
21486 if mcat1 not in (.,0) then c8= strip(put(mcat1,5.))||" ("||strip(put(mcat1/&&n&i*100,5.1))||")"; else c8="0"; NOTE: Line generated by the macro variable "I". 1 /&ni - 22 WARNING: Apparent symbolic reference NI not resolved. ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, a missing value, INPUT, PUT.
21487 if mcat2 not in (.,0) then c9= strip(put(mcat2,5.))||" ("||strip(put(mcat2/&&n&i*100,5.1))||")"; else c9="0"; NOTE: Line generated by the macro variable "I". 1 /&ni - 22 WARNING: Apparent symbolic reference NI not resolved. ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, a missing value, INPUT, PUT.
21488 21489 end; 21490 21491 21492 run;
... View more