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?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.