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;
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?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: