I am really having trouble finding the answer to the following simple question. Suppose I have an existing data set with one column of 100 observations, and I want to add a variable which has the value 0 in rows 1-50, and 1 in rows 51-100. How can I do it? I tried:
data new_data;
set existing_data;
do i = 1 to 100;
if i <= 50 then new_variable = 0;
if i >= 51 then new_variable = 1;
end;
run;
but it doesn't work.