DATA Step, Macro, Functions and more

?Resolving? an array value to put it into a sentence

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 128
Accepted Solution

?Resolving? an array value to put it into a sentence

[ Edited ]

Hi all,

 

I have an array code, and i'd like to convert bvar(i) to the actual variable name that it's referencing at the time and put it as text into another character field.  I've bolded it in the code. So i'd like for it to say xclm_thru## instead of bvar(i).

 

Any ideas?

 

Thanks

 

 

Data junk.x4b2_rewrite3 ;

    /*new vars*/
    array vvar(*) $200 case1 - case&max.;
    array wvar(*) new_clm_from1 - new_clm_from&max.;
    array xvar(*) new_clm_thru1 - new_clm_thru&max.;


        set junk.x4b2_rewrite2;
        /*existing vars*/
        array avar(*) xclm_from1 - xclm_from&max.;
        array bvar(*) xclm_thru1 - xclm_thru&max.;


    do i=1 to &max.;
        do j=2 to &max.;
        by kecc_id;
            if bvar(i) > avar(j) then do;
                wvar(i)=avar(i);    /*from*/
                xvar(i)=bvar(j);    /*thru*/
                vvar(i)="03 - bvar(i) next claim start date is earlier than current claim end date";
            end;

        end;
    end;
    format new_clm_from: new_clm_thru: mmddyy10.;
run;


Accepted Solutions
Solution
‎09-16-2016 01:38 PM
Frequent Contributor
Posts: 128

Re: ?Resolving? an array value to put it into a sentence

Got it.  Typical.  Messed around with it for more than 30 minutes before posting out here, and then 5 minutes later i find it.  Smiley Happy

 

                vvar(i)=cats("03 - ", vvalue(bvar(i))," > ", vvalue(avar(j))," next claim start date is earlier than current claim end date");

 

 

vvalue.  It doesn't give me xclm_from##, it gives me the value for xclm_from##, which is just as good for what I was looking for.

 

Thanks!

View solution in original post


All Replies
Solution
‎09-16-2016 01:38 PM
Frequent Contributor
Posts: 128

Re: ?Resolving? an array value to put it into a sentence

Got it.  Typical.  Messed around with it for more than 30 minutes before posting out here, and then 5 minutes later i find it.  Smiley Happy

 

                vvar(i)=cats("03 - ", vvalue(bvar(i))," > ", vvalue(avar(j))," next claim start date is earlier than current claim end date");

 

 

vvalue.  It doesn't give me xclm_from##, it gives me the value for xclm_from##, which is just as good for what I was looking for.

 

Thanks!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 187 views
  • 0 likes
  • 1 in conversation