<?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 CATX for use in temporary array, loss of precision in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/CATX-for-use-in-temporary-array-loss-of-precision/m-p/54799#M11622</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm running SAS ver 9.2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My goal is to obtain a string of numbers delimited by " " into a macro variable in order to use them as initial values for a _TEMPORARY_ array in a DATA STEP.&amp;nbsp; My method works but during the conversion I'm losing too many decimal places.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First I import the data from a CSV file with PROC IMPORT, which gives me columns with FORMAT BEST12.&amp;nbsp; Just to be safe I convert them to BEST32.&amp;nbsp; The numeric data is stored in the CSV file to about 16-18 decimal places (it's from R output).&amp;nbsp; The dataset is named dissert.lagalpha1 and consists of variables nodes1--nodes20 in BEST32. format.&amp;nbsp; I want a macro variables for all 20 nodes, seperated by spaces, with as much precision as possible.&amp;nbsp; I accomplish this with a DATA _NULL_ step and SYMPUTX function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SET dissert.lag1alpha1(WHERE=(var1="&amp;amp;num_nodes"));&lt;/P&gt;&lt;P&gt;CALL SYMPUTX('nodes1',CATX(" ",of node1--node&amp;amp;num_nodes)); &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;The macro variable &amp;amp;num_nodes is 20.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;The result is a list of numbers in BEST12. format, not BEST32, delimited by a blank space.&amp;nbsp; I can't figure out how to get CATX to maintain the BEST32. format of the variabes node1--node20.&amp;nbsp; can anybody think of another way to do this?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/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lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;I later use this variable in a _TEMPORARY_ array to decrease file size, because I'm essentially using the same 20 nodes over all 500 records in another dataset to perform a calculation.&amp;nbsp; I thought this way would be faster than just JOINING them.&amp;nbsp; But right now I think that might be the only viable option if I want to maintain the precision.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ARRAY arrNodes1 {&amp;amp;num_nodes} _TEMPORARY_ (&amp;amp;nodes1);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 27 Nov 2011 23:15:25 GMT</pubDate>
    <dc:creator>derrick</dc:creator>
    <dc:date>2011-11-27T23:15:25Z</dc:date>
    <item>
      <title>CATX for use in temporary array, loss of precision</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CATX-for-use-in-temporary-array-loss-of-precision/m-p/54799#M11622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm running SAS ver 9.2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My goal is to obtain a string of numbers delimited by " " into a macro variable in order to use them as initial values for a _TEMPORARY_ array in a DATA STEP.&amp;nbsp; My method works but during the conversion I'm losing too many decimal places.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First I import the data from a CSV file with PROC IMPORT, which gives me columns with FORMAT BEST12.&amp;nbsp; Just to be safe I convert them to BEST32.&amp;nbsp; The numeric data is stored in the CSV file to about 16-18 decimal places (it's from R output).&amp;nbsp; The dataset is named dissert.lagalpha1 and consists of variables nodes1--nodes20 in BEST32. format.&amp;nbsp; I want a macro variables for all 20 nodes, seperated by spaces, with as much precision as possible.&amp;nbsp; I accomplish this with a DATA _NULL_ step and SYMPUTX function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SET dissert.lag1alpha1(WHERE=(var1="&amp;amp;num_nodes"));&lt;/P&gt;&lt;P&gt;CALL SYMPUTX('nodes1',CATX(" ",of node1--node&amp;amp;num_nodes)); &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;The macro variable &amp;amp;num_nodes is 20.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;The result is a list of numbers in BEST12. format, not BEST32, delimited by a blank space.&amp;nbsp; I can't figure out how to get CATX to maintain the BEST32. format of the variabes node1--node20.&amp;nbsp; can anybody think of another way to do this?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt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lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;I later use this variable in a _TEMPORARY_ array to decrease file size, because I'm essentially using the same 20 nodes over all 500 records in another dataset to perform a calculation.&amp;nbsp; I thought this way would be faster than just JOINING them.&amp;nbsp; But right now I think that might be the only viable option if I want to maintain the precision.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ARRAY arrNodes1 {&amp;amp;num_nodes} _TEMPORARY_ (&amp;amp;nodes1);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 Nov 2011 23:15:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CATX-for-use-in-temporary-array-loss-of-precision/m-p/54799#M11622</guid>
      <dc:creator>derrick</dc:creator>
      <dc:date>2011-11-27T23:15:25Z</dc:date>
    </item>
    <item>
      <title>CATX for use in temporary array, loss of precision</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CATX-for-use-in-temporary-array-loss-of-precision/m-p/54800#M11623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is probably a more efficient way to code this, and you are still going to be hit with a numeric precision issue (on windows it will only take up to 14 decimal places), but I think that the following will do what you want:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET dissert.lag1alpha1(WHERE=(var1=&amp;amp;num_nodes));&lt;/P&gt;&lt;P&gt;&amp;nbsp; array nodes(*) node:;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length want $500.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; want=put(nodes(1),best32.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=2 to &amp;amp;num_nodes.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; want=catx(" ",want,put(nodes(i),best32.));&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CALL SYMPUTX('nodes1',want);&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 Nov 2011 23:48:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CATX-for-use-in-temporary-array-loss-of-precision/m-p/54800#M11623</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-11-27T23:48:25Z</dc:date>
    </item>
  </channel>
</rss>

