Hi, I need help running this!
data A;
do y=1 to 300;
if y < 5 and (1<x<6) then do;
do i=1 to 7;
do while (y-i>0);
B=(1-A(y-i));
end;
end;
end;
end;
output;
run;
So, I already have values for A(y) i.e. A(1), A(2),...A(300)
E.g. if y=4 then B= (1-A(4-1))*(1-A(4-2))*(1-A(4-3))
Thanks!
Hi,
Can you post some test data in the form of a datastep, and what the output should look like. I am not following you at all. Where does the variable X come into this, as its not described or set anywhere? Why the output statement at the end, its not needed. I assume a() is an array, what does the array define? Test data really helps.
First of all, your code yields a single error message:
ERROR 68-185: The function A is unknown, or cannot be accessed.
telling us that A() needs to be defined. Should it be an array, or is it a function defined elsewhere?
If it is a SAS array, it needs to be defined; it is also better to enclose the subscript in {}, making this more readable and clearer.
Once this is resolved, you will get a NOTE: about x being unitialized, which will cause the condition 1 < x < 6 to always be false, so your data step won't do anything at all (besides counting y to 300). B and i will stay missing in the dataset A.
So, where does x come from?
And what is the purpose of all this?
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.