BookmarkSubscribeRSS Feed
MTeck
Calcite | Level 5

Hello.

i have problem when running risk set sampling macro.

i  found this macro on this(http://mchp-appserv.cpe.umanitoba.ca/Upload/SAS/risk_set_sampling_macro.sas.txt)

 

this is my marco typing on SAS

%risk_set_match (cohort_name = CASE_CTRL,
                       outcome_var = outcome,
                       end_fu = END_EPI,
                       randnum = 123,
                       K = 20,
         control_index_dt = case_fu,
         rs_match_where = a.sex=b.sex
         id = JID,
         time0 = START_EPI,
         gender = sex,
         agevar = age,
         output_name = matched1,
         no_match = N
                      );

 

In the middle of macro, there is

-----------------------------------------------------------

   proc sql;
      create table risk as
      select
    a.&id. as case_ID,
             b.&id. as control_ID,
    a.&agevar. as case_age,
          b.&agevar. as control_age,
             a.&gender. as case_sex,
             b.&gender. as control_s,
             a.&time0. as case_t0,
             b.&time0. as control_t0,
          a.&end_fu. as case_endfu,
             b.&end_fu. as control_endfu,
          a.caco as case_caco,
          b.caco as control_caco,
             a.index_date,
             a.match_num
      from case_caco1_I a,
           controls b
      where &rs_match_where;
   quit;

   proc append base = risk_set data = risk;
   run;

----------------------------------------------------------------

In here such as case_ID, from ~~~, i have got errors.

ERROR 22-322 ~~~~

 

please answer me TT

 

1 REPLY 1
ballardw
Super User

Before running the macro set options MPRINT; so you can see the code generated by the macro. The error message will then appear in a better context indicating the issue.

 

If you retyped the code then double check on spelling and punctuation. If you added any comments using the *<text>; then replace them with either /* <text> */ or the macro specific %*<text>; as in line comments can be interpreted by the macro processor.

 

If you didn't type or modify the code then very carefully check that your data matches ALL of the requirements for the use of the macro.

 

If you can't figure out the error looking at the mprint output in the log then copy the entire output from the log and paste into a code box on the forum opened using the {I} icon. This last is important as the main message windows will reformat text making the position of the diagnostic characters that typically accompany errors like 22-322 shift a being less useful.