Hello everyone,
Nowadays, I am trying to convert the code from Visual Basic to SAS. When I tried to convert these codes, I had a difficulties, I did not find some functions which are corresponding to SAS code.
Can somebody help me to convert the following code, please?
Visual Basic Code
Dim xx() As Double, yy() As Double, n As Long, i As Long, temp As Double
Call UploadVector(xxrange, xx())
Call UploadVector(yyrange, yy())
n = UBound(xx(), 1)
temp = 0
For i = 0 To n
If xx(i) = 0 Then Exit For
If yy(i) = 0 Then yy(i) = 0.0000000000001
temp = xx(i) + temp
Next
n = i - 1
ReDim Preserve yy(n), xx(n)
For i = 0 To n
xx(i) = xx(i) / Target / temp
yy(i) = (1 - yy(i)) / yy(i)
Next
SAD_wsf = solve_adjustment(xx(), yy())
Exit Function
100 SAD_wsf = ""
End Function
SAS Code;
Data Want;
Set Have;
Array Xx{&CountX.} (&ArrayX.);
Array Yy{&CountY.} (&ArrayY.);
Call UploadVector(xxrange, xx());/*How can I conver this statement*/
Call UploadVector(yyrange, yy());/*How can I conver this statement*/
N=HBound(Xx,1);
Temp=0;
Do i=0 To N;
IF Xx{i}=0 Then Leave;
IF Yy{i}=0 Then Do;
Yy{i}=0.0000000000001;
Temp=Xx{i}+Temp;
End;
End;
/*ReDim Preserve yy(n), xx(n); How can I conver this statement */
N=i-1;
Do i=0 To N
Xx{i}=Xx{i}/Target/Temp;
Yy{i}=(1-Yy{i})/Yy{i};
End;
SAD_wsf=Solve_Adjustment(Xx{i},Yy{i});
100 SAD_wsf = ""; /*What does it mean*/
Run;
I just don't understand the meanning of Call UploadVector and ReDim Preserve. I thought a person who has some knowledge about Visual Basic, can help me to convert this options to SAS code?
Can somebody help me, please?
Thank you
... View more