Help using Base SAS procedures

Array Concept

Accepted Solution Solved
Reply
Super Contributor
Posts: 1,041
Accepted Solution

Array Concept

Hi,

Yet an other Array Question..

If the in: and out: is missing then I want to set the dept: to missing too

In the below example since in2 and out2 are missing  dept2     dept2_2 must be missing

Same with Dept3 and Dept3_3


in1             out1      dept1     dept1_1        in2     out2     dept2     dept2_2       in3     out 3     dept3       dept3_3

28Dec       30dec    CM         CM             .            .         DM          DM           .            .            PM        PM   

WANT:

in1             out1      dept1     dept1_1        in2     out2     dept2     dept2_2       in3     out 3     dept3       dept3_3

28Dec       30dec    CM         CM              .            .         .          .           .            .            .       .               .

Thanks


Accepted Solutions
Solution
‎05-28-2013 12:15 AM
Super User
Super User
Posts: 7,039

Re: Array Concept

Posted in reply to robertrao

Just loop over the array as in your other examples.

data want;

set have;

array in in1-in3;

array out out1-out3;

array d1 dept1-dept3 ;

array d2 dept2_1 - dept2_3 ;

do i=1 to dim(in);

  if 0=n(in(i),out(i)) then do; d1(i)=' ',d2(i)=' '; end;

end;

run;

View solution in original post


All Replies
Solution
‎05-28-2013 12:15 AM
Super User
Super User
Posts: 7,039

Re: Array Concept

Posted in reply to robertrao

Just loop over the array as in your other examples.

data want;

set have;

array in in1-in3;

array out out1-out3;

array d1 dept1-dept3 ;

array d2 dept2_1 - dept2_3 ;

do i=1 to dim(in);

  if 0=n(in(i),out(i)) then do; d1(i)=' ',d2(i)=' '; end;

end;

run;

🔒 This topic is solved and locked.

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

Discussion stats
  • 1 reply
  • 158 views
  • 0 likes
  • 2 in conversation