<?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: Change length of character variable and remove format and informat in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Change-length-of-character-variable-and-remove-format-and/m-p/696788#M25302</link>
    <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have(rename=(ssn=old_ssn));
  length ssn $ 11;
  drop old_ssn;
  ssn = substr(old_ssn, 1, 11);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 05 Nov 2020 07:17:20 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2020-11-05T07:17:20Z</dc:date>
    <item>
      <title>Change length of character variable and remove format and informat</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-length-of-character-variable-and-remove-format-and/m-p/696777#M25300</link>
      <description>&lt;P&gt;Hello!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My variable SSN (social security number) has the following attributes:&lt;/P&gt;&lt;P&gt;Obs 1: 485-40-2594&lt;/P&gt;&lt;P&gt;Length: 12&lt;/P&gt;&lt;P&gt;Type: Char&lt;/P&gt;&lt;P&gt;Format: $12.&lt;/P&gt;&lt;P&gt;Informat: $12.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create (or modify the current variable) that has the same name and values (SSN) but with a length of $11 and no formats or informats. When using LENGTH statements I end up with a warning in my log about truncating the variable. I do want the variable to sustain the same format of XXX-XX-XXXX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 05:47:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-length-of-character-variable-and-remove-format-and/m-p/696777#M25300</guid>
      <dc:creator>mady3</dc:creator>
      <dc:date>2020-11-05T05:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: Change length of character variable and remove format and informat</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-length-of-character-variable-and-remove-format-and/m-p/696788#M25302</link>
      <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have(rename=(ssn=old_ssn));
  length ssn $ 11;
  drop old_ssn;
  ssn = substr(old_ssn, 1, 11);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Nov 2020 07:17:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-length-of-character-variable-and-remove-format-and/m-p/696788#M25302</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-11-05T07:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: Change length of character variable and remove format and informat</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-length-of-character-variable-and-remove-format-and/m-p/696898#M25305</link>
      <description>&lt;P&gt;So it sounds like you have this data:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  attrib SSN length=$12 format=$12. informat=$12. ;
  input ssn;
cards;
485-40-2594
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And you did something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  length SSN $11;
  set have;
  format ssn;
  informat ssn;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To avoid the warning you can just make a new variable instead.&amp;nbsp; That will also mean you don't need to do anything to remove format or informat (as long you you never attach any format or informat to the new variable).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have;
  length new $11;
  new=ssn;
  drop ssn;
  rename new=SSN;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 15:18:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-length-of-character-variable-and-remove-format-and/m-p/696898#M25305</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-11-05T15:18:32Z</dc:date>
    </item>
  </channel>
</rss>

