How to declare macro variable within datastep and using it within

Discussion in 'SAS (Statistical Analysis Software)' started by cherish k, Sep 11, 2008.

  1. cherish k

    cherish k Guest

    data chk;
    do i = 1 to 10;
    array m(10);
    do j = 1 to 10;
    m(j) = round(ranuni(0)*100);
    val = round(ranuni(0)*5 + 1);

    data chk1;
    set chk(keep = val);
    p = _n_;
    %let arr_ele = val;
    set chk(keep = m%eval(&arr_ele)) point = p;
    req_val = m%eval(&arr_ele);
    drop m%eval(&arr_ele);

    Obviously this doesn't work. I need to read the val for each element and corrsponding array element i have to pick. Similarly i have to do it for each record. I dont want to keep the entire array and then read by using m(val) as the array size is huge. Can you please suggest a way to declare a macro variable and then use it within data step.

    cherish k, Sep 11, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.