<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic What is the meanning of Call&amp;amp;ReDim Preserve functions meaning on SAS?(VB.Net) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-meanning-of-Call-amp-ReDim-Preserve-functions/m-p/286652#M58829</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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&amp;nbsp;SAS code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can somebody help me to convert the following code, please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Visual Basic Code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Code;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Want;
Set Have;

Array Xx{&amp;amp;CountX.} (&amp;amp;ArrayX.);
Array Yy{&amp;amp;CountY.} (&amp;amp;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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can somebody help me, please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 24 Jul 2016 12:21:37 GMT</pubDate>
    <dc:creator>turcay</dc:creator>
    <dc:date>2016-07-24T12:21:37Z</dc:date>
    <item>
      <title>What is the meanning of Call&amp;ReDim Preserve functions meaning on SAS?(VB.Net)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-meanning-of-Call-amp-ReDim-Preserve-functions/m-p/286652#M58829</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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&amp;nbsp;SAS code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can somebody help me to convert the following code, please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Visual Basic Code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Code;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Want;
Set Have;

Array Xx{&amp;amp;CountX.} (&amp;amp;ArrayX.);
Array Yy{&amp;amp;CountY.} (&amp;amp;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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can somebody help me, please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2016 12:21:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-meanning-of-Call-amp-ReDim-Preserve-functions/m-p/286652#M58829</guid>
      <dc:creator>turcay</dc:creator>
      <dc:date>2016-07-24T12:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: What is the meanning of Call&amp;ReDim Preserve functions meaning on SAS?(VB.Net)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-meanning-of-Call-amp-ReDim-Preserve-functions/m-p/286653#M58830</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Looking in the MSDN doc, it seems that those might have something to do with ARRAY processing in VB:&lt;/P&gt;
&lt;P&gt;Call &lt;A href="https://msdn.microsoft.com/en-us/library/sxz296wz.aspx" target="_blank"&gt;https://msdn.microsoft.com/en-us/library/sxz296wz.aspx&lt;/A&gt; &lt;BR /&gt;Transfers control to a Function, Sub, or dynamic-link library (DLL) procedure.&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;So you need to find out what the "UploadVector" function, sub or DLL does&lt;BR /&gt;Here's the MSDN site for the Function statement: &lt;A href="https://msdn.microsoft.com/en-us/library/sect4ck6.aspx" target="_blank"&gt;https://msdn.microsoft.com/en-us/library/sect4ck6.aspx&lt;/A&gt; &lt;BR /&gt;Here's the MSDN site for the Sub statement: &lt;A href="https://msdn.microsoft.com/en-us/library/dz1z94ha.aspx" target="_blank"&gt;https://msdn.microsoft.com/en-us/library/dz1z94ha.aspx&lt;/A&gt; &lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;ReDim Statement re-allocates storage space for an array variable &lt;BR /&gt;&lt;A href="https://msdn.microsoft.com/en-us/library/w8k3cys2.aspx" target="_blank"&gt;https://msdn.microsoft.com/en-us/library/w8k3cys2.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried just recoding them using SAS Array processing, such as we show in the Programming 2 class? It seems, for example, that ReDim is allocating storage, which you don't need to worry about with SAS Arrays.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a paper on SAS Arrays to get you started: &lt;A href="https://support.sas.com/rnd/papers/sgf07/arrays1780.pdf" target="_blank"&gt;https://support.sas.com/rnd/papers/sgf07/arrays1780.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2016 13:06:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-meanning-of-Call-amp-ReDim-Preserve-functions/m-p/286653#M58830</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-07-24T13:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: What is the meanning of Call&amp;ReDim Preserve functions meaning on SAS?(VB.Net)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-meanning-of-Call-amp-ReDim-Preserve-functions/m-p/286668#M58834</link>
      <description>Vb and SAS are two quite different beasts.&lt;BR /&gt;Conversion of code line by line is not a good idea,  handed are that you end up with quite a messy SAS application. &lt;BR /&gt;It's better to define the requirements, like what the old application produced with what input data. Then design and develop your SAS application based on that, not individual lines of Vb code.</description>
      <pubDate>Sun, 24 Jul 2016 15:36:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-meanning-of-Call-amp-ReDim-Preserve-functions/m-p/286668#M58834</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-07-24T15:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: What is the meanning of Call&amp;ReDim Preserve functions meaning on SAS?(VB.Net)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-meanning-of-Call-amp-ReDim-Preserve-functions/m-p/286687#M58842</link>
      <description>&lt;P&gt;You also need to be familiar with your data structure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your data/array is in a row then you'll need a loop, but if your data/array is in a column then you won't need the loop because of SAS implicit loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I highly echo&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH﻿&lt;/a&gt;&amp;nbsp;recommendation. Determine what process is doing and replicate that. Test them against each other.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2016 18:29:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-meanning-of-Call-amp-ReDim-Preserve-functions/m-p/286687#M58842</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-24T18:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: What is the meanning of Call&amp;ReDim Preserve functions meaning on SAS?(VB.Net)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-meanning-of-Call-amp-ReDim-Preserve-functions/m-p/286715#M58863</link>
      <description>&lt;P&gt;I agree with above comments entirely.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That said,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt; ReDim Preserve yy&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;n&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; xx&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;n&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;serves to redimension arrays yy and xx to size n and to keep their current values (up to size n). Array redimensioning doesn't exist is SAS datastep programming. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2016 22:34:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-meanning-of-Call-amp-ReDim-Preserve-functions/m-p/286715#M58863</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-07-24T22:34:58Z</dc:date>
    </item>
  </channel>
</rss>

