I am so lost with this homework assignment but hopefully this will be the last question! The problem instructs us to Use a DO loop and the SUBSTR function to write the SAS code (a complete SAS data step) that would do the same thing as ANYSPACE Function. We have to use two different statements one with a do index and another with a do while. I am just working on the first one for now and made a fake data set. This is what I have but it is completely wrong:
data Question4;
length City $10;
input City $;
datalines;
New York
New Mexico
Las Vegas
;
run;
data new2;
set Question4 (drop = x y);
do x = 1 to 3;
y = substr(City,x,4);
y = ANYSPACE;
end;
run;
Proc Print data=new2;
run;
What should I be focusing on to correct it?