<?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 Re: load in the numeric variable with length of 2 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777305#M247263</link>
    <description>I just use a lib statement to point to the server.&lt;BR /&gt;libname CBIT remote "mainframe_file_name" disp=shr server=server_name;</description>
    <pubDate>Fri, 29 Oct 2021 14:30:28 GMT</pubDate>
    <dc:creator>89lilywang89</dc:creator>
    <dc:date>2021-10-29T14:30:28Z</dc:date>
    <item>
      <title>load in the numeric variable with length of 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777285#M247254</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to read a SAS file, which saved on Mainframe. The file has a numeric variable with length of 2. How can I load this file into my Windows SAS? I have try to use the length statement, but it always give me this error: "One or more numeric variables could not be converted to the target representation&lt;BR /&gt;because they are shorter than the target representation allows."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really appreciate your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 13:47:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777285#M247254</guid>
      <dc:creator>89lilywang89</dc:creator>
      <dc:date>2021-10-29T13:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: load in the numeric variable with length of 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777287#M247256</link>
      <description>&lt;P&gt;So you cannot use CEDA to read Mainframe files on Window, so HOW are you trying to read the dataset in Windows?&lt;/P&gt;
&lt;P&gt;Show the code you ran that generated that message.&amp;nbsp; Use the Insert Code button to get a pop-up window to paste/edit the lines from the SAS log that show the code and the errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LENGTH of a variable is how many bytes to store in the dataset.&amp;nbsp; For numeric variables if you use a length less than 8 it just throws away the lower order bytes. In general you should always just use 8 bytes for numbers so the full 64 bit floating point number is saved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because the Mainframe uses a different floating point representation you can use a storage length of 2.&amp;nbsp; But on Window/Unix that wouldn't leave any room for storing the actual number.&amp;nbsp; So the minimum length you can use is 3.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 13:53:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777287#M247256</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-10-29T13:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: load in the numeric variable with length of 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777301#M247260</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;I need to get the data source form Mainframe. I have assign a libname to the mainframe server. Then I run a simple data step to transfer the data into my local PC, then work on it. The variable "Status" has the length of 2 (numeric). There is the error msg:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data sample;
length status 8.;
SET CBIT.DATA ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ERROR: One or more numeric variables could not be converted to the target representation
       because they are shorter than the target representation allows.
NOTE: The DATA step has been abnormally terminated.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.SAMPLE may be incomplete.  When this step was stopped there were 0
         observations and 7 variables.
WARNING: Data set WORK.SAMPLE was not replaced because this step was stopped.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 14:16:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777301#M247260</guid>
      <dc:creator>89lilywang89</dc:creator>
      <dc:date>2021-10-29T14:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: load in the numeric variable with length of 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777303#M247262</link>
      <description>&lt;P&gt;What is the CBIT libref pointing at?&amp;nbsp; Are you using SAS/Connect?&amp;nbsp; SAS/Share?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 14:23:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777303#M247262</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-10-29T14:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: load in the numeric variable with length of 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777305#M247263</link>
      <description>I just use a lib statement to point to the server.&lt;BR /&gt;libname CBIT remote "mainframe_file_name" disp=shr server=server_name;</description>
      <pubDate>Fri, 29 Oct 2021 14:30:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777305#M247263</guid>
      <dc:creator>89lilywang89</dc:creator>
      <dc:date>2021-10-29T14:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: load in the numeric variable with length of 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777306#M247264</link>
      <description>I just use the Base SAS</description>
      <pubDate>Fri, 29 Oct 2021 14:32:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777306#M247264</guid>
      <dc:creator>89lilywang89</dc:creator>
      <dc:date>2021-10-29T14:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: load in the numeric variable with length of 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777324#M247274</link>
      <description>&lt;P&gt;So you are connecting to a SAS/Share server on the mainframe.&lt;/P&gt;
&lt;P&gt;This old 9.1 documentation indicates you cannot transfer the 2 byte numeric variables that way.&amp;nbsp;&amp;nbsp;&lt;A href="https://support.sas.com/documentation/onlinedoc/91pdf/sasdoc_91/share_ug_7261.pdf" target="_blank"&gt;https://support.sas.com/documentation/onlinedoc/91pdf/sasdoc_91/share_ug_7261.pdf&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 705px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65228i16849C94E9CFE6DF/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Have someone with direct access to the mainframe convert the file.&amp;nbsp; They could create a new dataset using LENGTH=3 for those variable(s).&amp;nbsp; &amp;nbsp;Perhaps even just create view for you to access.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have access to use SAS/Connect instead of SAS/Share then try using PROC DOWNLOAD to copy the data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rsubmit;
libname CBIT "mainframe_file_name" access=readonly ;
proc download inlib=CBIT outlib=work;
run;
endrsubmit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If that doesn't work then try making a work dataset on the remote that fixes the lengths and downloading that.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rsubmit;
libname CBIT "mainframe_file_name" access=readonly ;
data work.copy;
  set CBIT.MYTABLE;
  length _numeric_ 8;
run;
proc download data=copy out=work.mytable;
run;
endrsubmit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 15:08:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777324#M247274</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-10-29T15:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: load in the numeric variable with length of 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777345#M247285</link>
      <description>Thanks so much. The second code run without error. But the work.copy file has 0 observations.</description>
      <pubDate>Fri, 29 Oct 2021 16:15:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777345#M247285</guid>
      <dc:creator>89lilywang89</dc:creator>
      <dc:date>2021-10-29T16:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: load in the numeric variable with length of 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777349#M247289</link>
      <description>&lt;P&gt;You need to know what members are stored in the library that is the physical file on the mainframe.&lt;/P&gt;
&lt;P&gt;I just used MYTABLE as a place holder. Use the real member name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The interface makes it hard to see the full thread when replying.&amp;nbsp; Looking at your earlier posts you where using a member name of DATA before.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 16:21:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777349#M247289</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-10-29T16:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: load in the numeric variable with length of 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777350#M247290</link>
      <description>Hi Tom,&lt;BR /&gt;Yes, I did change the MYTABLE to the really table name.</description>
      <pubDate>Fri, 29 Oct 2021 16:22:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777350#M247290</guid>
      <dc:creator>89lilywang89</dc:creator>
      <dc:date>2021-10-29T16:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: load in the numeric variable with length of 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777354#M247292</link>
      <description>&lt;P&gt;Read the notes in the log to see more about what is happening.&amp;nbsp; Are you sure you remote submitted the code to the same server you where connected to with your REMOTE libref? The same file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try running proc contents on the mainframe side to see how many observations.&amp;nbsp; Perhaps there were always zero obs, but SAS was still throwing the error because of the length of 2 even though it wouldn't matter if there wasn't any values to convert.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 16:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777354#M247292</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-10-29T16:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: load in the numeric variable with length of 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777943#M247595</link>
      <description>&lt;P&gt;The second code works ^O^. Thanks so much.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 15:37:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/load-in-the-numeric-variable-with-length-of-2/m-p/777943#M247595</guid>
      <dc:creator>89lilywang89</dc:creator>
      <dc:date>2021-11-02T15:37:37Z</dc:date>
    </item>
  </channel>
</rss>

