<?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 matching in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269737#M53477</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using Proc Optnet for matching my cases with controls (both as independent datasets), please see below. I can do that in Work library; however, when I try to do that for my permamnet folder/Libref it does not work. The log says: Work.Links.Data not available. I have one file as pe.Links in my permanent library. How can I add libref with proc optnent? Thanks&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; optnet &lt;FONT color="#FF0000"&gt;data_links&lt;/FONT&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;links graph_direction&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;directed&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
data_links_var &lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;sampleNode to&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;controlNode &lt;SPAN class="token statement"&gt;weight&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token procnames"&gt;distance&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
linear_assignment out&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;bestMatches&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; 
    &lt;SPAN class="token function"&gt;floor&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;sampleNode&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; as sampleId&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;
    controlNode as controlId
&lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; bestMatches&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 May 2016 14:14:12 GMT</pubDate>
    <dc:creator>wajmsu</dc:creator>
    <dc:date>2016-05-11T14:14:12Z</dc:date>
    <item>
      <title>matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269737#M53477</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using Proc Optnet for matching my cases with controls (both as independent datasets), please see below. I can do that in Work library; however, when I try to do that for my permamnet folder/Libref it does not work. The log says: Work.Links.Data not available. I have one file as pe.Links in my permanent library. How can I add libref with proc optnent? Thanks&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; optnet &lt;FONT color="#FF0000"&gt;data_links&lt;/FONT&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;links graph_direction&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;directed&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
data_links_var &lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;sampleNode to&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;controlNode &lt;SPAN class="token statement"&gt;weight&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token procnames"&gt;distance&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
linear_assignment out&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;bestMatches&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; 
    &lt;SPAN class="token function"&gt;floor&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;sampleNode&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; as sampleId&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;
    controlNode as controlId
&lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; bestMatches&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 14:14:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269737#M53477</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-05-11T14:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269742#M53479</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/74799"&gt;@wajmsu﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, you have a file links.sas7bdat in your permanent folder and the libref &lt;FONT face="courier new,courier" size="3"&gt;pe&lt;/FONT&gt; has been assigned to this folder?&lt;/P&gt;
&lt;P&gt;Have you tried &lt;FONT face="courier new,courier"&gt;proc optnet data_links=&lt;STRONG&gt;pe.&lt;/STRONG&gt;links&lt;/FONT&gt; ...?&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 14:28:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269742#M53479</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-11T14:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269792#M53493</link>
      <description>&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Valued-Guide"&gt;Hi FreelanceReinhard,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Valued-Guide"&gt;Thanks, it worked as far as not getting any log error. However, the very next issue comes about the 'from' and 'to' as shown below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Valued-Guide"&gt;OTE: ----------------------------------------------------------------------------------------------&lt;BR /&gt;ERROR: The FROM and TO variables in the DATA_LINKS= data set must have the same type.&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;WARNING: The data set PE.BESTMATCHES may be incomplete.&amp;nbsp; When this step was stopped there were 0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; observations and 0 variables.&lt;BR /&gt;WARNING: Data set PE.BESTMATCHES was not replaced because this step was stopped.&lt;BR /&gt;NOTE: PROCEDURE OPTNET used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.23 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.21 seconds&lt;BR /&gt;&lt;BR /&gt;36&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;37&amp;nbsp;&amp;nbsp; proc sql;&lt;BR /&gt;38&amp;nbsp;&amp;nbsp; select&lt;BR /&gt;39&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; floor(sampleNode) as sampleId,&lt;BR /&gt;40&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; controlNode as controlId&lt;BR /&gt;41&amp;nbsp;&amp;nbsp; from pe.bestMatches;&lt;BR /&gt;ERROR: Table PE.BESTMATCHES doesn't have any columns. PROC SQL requires each of its tables to have&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at least 1 column.&lt;BR /&gt;ERROR: Function FLOOR requires a numeric expression as argument 1.&lt;BR /&gt;ERROR: The following columns were not found in the contributing tables: controlNode, sampleNode.&lt;BR /&gt;42&amp;nbsp;&amp;nbsp; quit;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 16:39:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269792#M53493</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-05-11T16:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269799#M53494</link>
      <description>&lt;P&gt;I think the error message is fairly explicit: "&lt;SPAN&gt;The FROM and TO variables in the DATA_LINKS= data set must have the same type."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This makes sense, because both should contain elements &lt;EM&gt;of the same set&lt;/EM&gt;: the set of nodes of a graph. These can be labeled with character strings (e.g. 'A', 'B', 'C', ...) or numbers (e.g. 1, 2, 3, ...).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It appears that you specified a character variable and a numeric variable.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 16:48:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269799#M53494</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-11T16:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269822#M53498</link>
      <description>&lt;P&gt;You are right; Controlnode is character fromat and informat=$4.&lt;/P&gt;&lt;P&gt;Samplenode is numeric format=10.2 ans infromat=10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Controlnode is 4 digits and samplenode is 0000.00. I want to to convert to numeric, is it ok, please guide me? What should be the format and informat for controlnode (changing from character to numeric)?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 17:35:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269822#M53498</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-05-11T17:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269835#M53500</link>
      <description>&lt;P&gt;I have added format for conrolNode in the sas code as shown below. This format was not present in the sas code previosuly. However, it does not change the type in the data file but log says: 'converted from character to numeric'. WHen I run proc optnet statement, the message comes.&lt;/P&gt;&lt;P&gt;Thanks for your time and support!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 18:30:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269835#M53500</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-05-11T18:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269845#M53504</link>
      <description>&lt;P&gt;I'm not familiar with PROC OPTNET, but I assume that neither the format nor the informat of a variable, but the variable&lt;EM&gt; value&lt;/EM&gt; is most important for the FROM and TO variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This being the case, it seems a bit odd to me that the values of sampleNode and controlNode look so different. Format 10.2 would make sense only if sampleNode contained values with non-zero decimal places such as 1234.56. Obviously, numbers like this would not fit into a character variable of length 4. In your PROC SQL step you applied the FLOOR function to sampleNode. This again suggests that there are decimal places..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, you can convert controlNode to a numeric variable:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data links_new;
set links;
numcn=input(controlNode, 4.);
drop controlNode;
rename numcn=controlNode;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, you should make sure that the numeric values in variable sampleNode are in fact integers. Please note that values of numeric variables in SAS sometimes look like integers (e.g. 3), but a close examination reveals that their true value is something like 3.0000000000000004. To avoid this, you could add a statement like &lt;FONT face="courier new,courier"&gt;sampleNode=round(sampleNode)&lt;/FONT&gt;&amp;nbsp;or &lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;sampleNode=floor(sampleNode)&lt;/FONT&gt;&amp;nbsp;&lt;/SPAN&gt;to the above data step, but these are not equivalent. You have to know your data and whether non-integers should be &lt;EM&gt;rounded&lt;/EM&gt; or &lt;EM&gt;truncated&lt;/EM&gt; to integers in order to match controlNode values.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 18:47:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/matching/m-p/269845#M53504</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-11T18:47:50Z</dc:date>
    </item>
  </channel>
</rss>

