BookmarkSubscribeRSS Feed
R_A_G_
Calcite | Level 5

I have a follow up question. I want to change these values but when I do it my values are only 0's and 1's.

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
Tom
Super User Tom
Super User

You appear to be missing some ELSE keywords.

The first block of IF/THEN/ELSE clauses will convert the value to 0,1,2, or 3.

The second block will then flip those into 2 or 0.  The 0's will be come 1's and the higher numbers will be 0's.

The third block will then flip the 1/0 values.

Perhaps you are trying to create three new variables from each existing variable?

Or perhaps you really wanted to do some type of aggregation over the values? If so did you want to aggregate horizontally across the variables in a particular observation or vertically across the observations in your dataset?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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