<?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: Variable created with PUT format not correct length in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Variable-created-with-PUT-format-not-correct-length/m-p/749518#M235541</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/289103"&gt;@RoddyJ&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would check the &lt;EM&gt;default length&lt;/EM&gt; of format &lt;FONT face="courier new,courier"&gt;$teamf.&lt;/FONT&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format fmtlib;
select $teamf;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output starts like this:&lt;/P&gt;
&lt;PRE&gt;----------------------------------------------------------------------------
|       FORMAT NAME: $TEAMF   LENGTH:   &lt;STRONG&gt;&lt;FONT size="4" color="#008000"&gt;20 &lt;/FONT&gt;&lt;/STRONG&gt;  NUMBER OF VALUES:    3        |
|   MIN LENGTH:   1  MAX LENGTH:  40  &lt;STRONG&gt;DEFAULT LENGTH:&lt;/STRONG&gt;  &lt;STRONG&gt;&lt;FONT size="4" color="#FF0000"&gt;12&lt;/FONT&gt;&lt;/STRONG&gt;  FUZZ:        0  |
&lt;/PRE&gt;
&lt;P&gt;If the default length is smaller than the length (as shown above), truncation will occur for longer values (unless you specify a greater length in the PUT statement as suggested by&amp;nbsp;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159" target="_blank" rel="noopener"&gt;Tom&lt;/A&gt;; this length is limited by the maximum length, 40 in the example). The default length might have been set inappropriately by&amp;nbsp;a variable named &lt;FONT face="courier new,courier"&gt;default&lt;/FONT&gt;&amp;nbsp;in&amp;nbsp;dataset &lt;FONT face="courier new,courier"&gt;neonate_formats&lt;/FONT&gt;&amp;nbsp;which has too small a value in the first observation for format &lt;FONT face="courier new,courier"&gt;$teamf.&lt;/FONT&gt;.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jun 2021 13:17:31 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2021-06-22T13:17:31Z</dc:date>
    <item>
      <title>Variable created with PUT format not correct length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-created-with-PUT-format-not-correct-length/m-p/749493#M235527</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using a format created with the below code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format cntlin=neonate_formats;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To format a character variable from a character code to a name. Some the resulting variable isn't the correct length so some of the rows have the name cut off.&lt;/P&gt;
&lt;P&gt;I've put in a length statement in the datastep and that hasn't helped, I can't think what else to do. I'm not sure if the fault is in the format (checked the dataset used to create the format and that's as expected). Can anyone help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Datastep looks like below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data formatted;
length team $100;
set unformatted;

team = put(uteam, $teamf.);

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Jun 2021 12:03:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-created-with-PUT-format-not-correct-length/m-p/749493#M235527</guid>
      <dc:creator>RoddyJ</dc:creator>
      <dc:date>2021-06-22T12:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Variable created with PUT format not correct length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-created-with-PUT-format-not-correct-length/m-p/749503#M235531</link>
      <description>&lt;P&gt;Changing the length of the target variable means there is room for longer strings.&lt;/P&gt;
&lt;P&gt;To have the PUT function generate longer strings you should either tell it that in the format specification by including a width.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;team = put(uteam, $teamf100.);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or change the default width in the format definition.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 12:33:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-created-with-PUT-format-not-correct-length/m-p/749503#M235531</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-22T12:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Variable created with PUT format not correct length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-created-with-PUT-format-not-correct-length/m-p/749518#M235541</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/289103"&gt;@RoddyJ&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would check the &lt;EM&gt;default length&lt;/EM&gt; of format &lt;FONT face="courier new,courier"&gt;$teamf.&lt;/FONT&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format fmtlib;
select $teamf;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output starts like this:&lt;/P&gt;
&lt;PRE&gt;----------------------------------------------------------------------------
|       FORMAT NAME: $TEAMF   LENGTH:   &lt;STRONG&gt;&lt;FONT size="4" color="#008000"&gt;20 &lt;/FONT&gt;&lt;/STRONG&gt;  NUMBER OF VALUES:    3        |
|   MIN LENGTH:   1  MAX LENGTH:  40  &lt;STRONG&gt;DEFAULT LENGTH:&lt;/STRONG&gt;  &lt;STRONG&gt;&lt;FONT size="4" color="#FF0000"&gt;12&lt;/FONT&gt;&lt;/STRONG&gt;  FUZZ:        0  |
&lt;/PRE&gt;
&lt;P&gt;If the default length is smaller than the length (as shown above), truncation will occur for longer values (unless you specify a greater length in the PUT statement as suggested by&amp;nbsp;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159" target="_blank" rel="noopener"&gt;Tom&lt;/A&gt;; this length is limited by the maximum length, 40 in the example). The default length might have been set inappropriately by&amp;nbsp;a variable named &lt;FONT face="courier new,courier"&gt;default&lt;/FONT&gt;&amp;nbsp;in&amp;nbsp;dataset &lt;FONT face="courier new,courier"&gt;neonate_formats&lt;/FONT&gt;&amp;nbsp;which has too small a value in the first observation for format &lt;FONT face="courier new,courier"&gt;$teamf.&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 13:17:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-created-with-PUT-format-not-correct-length/m-p/749518#M235541</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-06-22T13:17:31Z</dc:date>
    </item>
  </channel>
</rss>

