Help using Base SAS procedures

If-Then

Reply
Regular Contributor
Posts: 161

If-Then

would some one help with this code. Instead of 0 1 2 3 I get only 0's and 1's why?

data IEEE.item_coded (drop=item1-item116 iii);

set IEEE.item;

array f_item(116);

array item(*) item1-item116;

do iii=1 to 116;

  if item{iii}<0.000623175 then f_item{iii}=3;

   else if item{iii} lt 0.002864969 then f_item{iii}=2;

   else if item{iii} lt 0.013617708 then f_item{iii}=1;

   else if item{iii} le 0.431834293 then f_item{iii}=0;

  if item{iii} lt 0.001041523 then f_item{iii}=2;

   else if item{iii} lt 0.008116862 then f_item{iii}=1;

   else if item{iii} le 0.431834293 then f_item{iii}=0;

  if item{iii} lt 0.002864969 then f_item{iii}=1;

   else if item{iii} le 0.431834293 then f_item{iii}=0;

end;

run;

PROC Star
Posts: 7,480

Re: If-Then

Tom already replied to this in a duplicate posting you made.  I have to ask: "did you really intend on having duplicate if-then-else statements?  The first four lines, under your do loop, recode the values.  What, if any, was the purpose of the second and third groups of if-then-else statements?

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