BookmarkSubscribeRSS Feed
R_A_G_
Calcite | Level 5

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;

1 REPLY 1
art297
Opal | Level 21

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?

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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