<?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: Changing the length of a character variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/307646#M65922</link>
    <description>The problem with using the length statement before setting the data set is that the modified variable will be the first variable in the new data set.  The SQL statement can alter variables without changing their order.</description>
    <pubDate>Thu, 27 Oct 2016 14:11:53 GMT</pubDate>
    <dc:creator>BarryDeCicco</dc:creator>
    <dc:date>2016-10-27T14:11:53Z</dc:date>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15905#M2144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way to change the length of a character variable?&amp;nbsp; I am using proc import to import&lt;/P&gt;&lt;P&gt;data from a .dbf file.&amp;nbsp; One of the data fields is character and 5 characters wide.&amp;nbsp; I would like&lt;/P&gt;&lt;P&gt;to later assign larger character strings to this variable.&amp;nbsp; To do this I create a new variable in a&lt;/P&gt;&lt;P&gt;separate data step to do this.&amp;nbsp; Is there more elegant way?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 16:56:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15905#M2144</guid>
      <dc:creator>WesBarris</dc:creator>
      <dc:date>2011-09-23T16:56:46Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15906#M2145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Include a length statement before your set statement.&amp;nbsp; e.g.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.class;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc contents;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length Name $30;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_ eq 1 then Name="Rumpelstiltskin";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc contents;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 17:03:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15906#M2145</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-23T17:03:19Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15907#M2146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a perfect opportunity to leverage some PROC SQL &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; Assuming your imported data set is "lib.have" and the name of the character variable you want to modify is "TextVar", this should work for you:&lt;/P&gt;&lt;PRE&gt; 
proc sql;
alter table lib.have
&amp;nbsp; modify TextVar char(20) format=$20. informat=$20.;
quit;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 18:09:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15907#M2146</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2011-09-23T18:09:12Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15908#M2147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Art.&amp;nbsp; That is what I was looking for.&amp;nbsp; However, in order for me to make this&lt;/P&gt;&lt;P&gt;work I hand to change "length" to "format".&amp;nbsp; Using "length" didn't allow me to reset&lt;/P&gt;&lt;P&gt;any character variable to hold longer strings.&amp;nbsp; Here is some sample code showing&lt;/P&gt;&lt;P&gt;what I had to do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format Name $30.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_ eq 1 then Name="Rumpelstiltskin";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 19:12:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15908#M2147</guid>
      <dc:creator>WesBarris</dc:creator>
      <dc:date>2011-09-23T19:12:59Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15909#M2148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Out of curiosity, what version of SAS are you using and on which platform?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For me, on 9.2 on an XP, both length and format change the other accordingly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 19:26:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15909#M2148</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-23T19:26:56Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15910#M2149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Art,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are running SAS 9.2 on Windows server 2008.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 19:29:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15910#M2149</guid>
      <dc:creator>WesBarris</dc:creator>
      <dc:date>2011-09-23T19:29:27Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15911#M2150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you used the length statement did you make sure that it wasn't expressed as a format?&amp;nbsp; i.e., did you use $30 and NOT $30. ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 19:34:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15911#M2150</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-23T19:34:59Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15912#M2151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is correct.&amp;nbsp; The length statement I tried was:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;length wingband $6;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I changed that to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;format wingband $6.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it worked for me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 19:42:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15912#M2151</guid>
      <dc:creator>WesBarris</dc:creator>
      <dc:date>2011-09-23T19:42:46Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15913#M2152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad it worked!&amp;nbsp; Unless someone more knowedgeable than me can quickly provide an answer regarding why the length statement didn't work, I'll see if I can find out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 19:45:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15913#M2152</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-23T19:45:36Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15914#M2153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All of my testing with SAS 9.1.3 PC and SAS 9.2 Unix shows length statement working properly.&amp;nbsp; Of course, the length statement needs to be at the beginning of the data step prior to the set statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am at a loss to understand why it wouldn't work without seeing the actual program and logs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 20:48:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15914#M2153</guid>
      <dc:creator>DLing</dc:creator>
      <dc:date>2011-09-23T20:48:56Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15915#M2154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's probable that, when you imported the data from dBase,&amp;nbsp; PROC IMPORT assigned a permanent format of $5. to the NAME variable.&amp;nbsp; If that is true, this code:&lt;/P&gt;&lt;PRE&gt;
data have;
&amp;nbsp; length Name $ 30;
&amp;nbsp; set have;
&amp;nbsp; if _n_ eq 1 then Name="Rumpelstiltskin";
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;actually DID change the length of the variable, but it was only displaying 5 characters by default, because of the format.&amp;nbsp; Subsequently running this code:&lt;/P&gt;&lt;PRE&gt;
data have;
&amp;nbsp; format Name $30.;
&amp;nbsp; set have;
&amp;nbsp; if _n_ eq 1 then Name="Rumpelstiltskin";
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;would replace the $5. format with $30. and allow the extra characters to display.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This PROC SQL solution simultaneously modifies both the length of the variable and the format:&lt;/P&gt;&lt;PRE&gt;
proc sql;
alter table lib.have
&amp;nbsp; modify TextVar char(20) format=$20.;
quit;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, you could use both LENGTH and FORMAT statements in the DATA step code to accomplish the same result:&lt;/P&gt;&lt;PRE&gt;
data have;
&amp;nbsp; length Name $30;
&amp;nbsp; format Name $30.;
&amp;nbsp; set have;
&amp;nbsp; if _n_ eq 1 then Name="Rumpelstiltskin";
run;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Sep 2011 02:41:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15915#M2154</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2011-09-24T02:41:03Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15916#M2155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since the data is being imported from a dBase file your explanation must be correct.&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 Sep 2011 20:56:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15916#M2155</guid>
      <dc:creator>WesBarris</dc:creator>
      <dc:date>2011-09-25T20:56:18Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15917#M2156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is one of my pet peeves with SAS's implementation of importing data from databases.&amp;nbsp; They always attach both a format and an informat to character variables.&amp;nbsp; As you have seen this can cause a number of headaches when you start combining that data with other datasets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In general permanently attaching the $ format to a character variable adds nothing of value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only way I know to remove these is to use the FORMAT (or INFORMAT) statement with a variable list, but without a format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data sasfile ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set dbfile ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format _character_ ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 Sep 2011 21:35:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15917#M2156</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-09-25T21:35:06Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15918#M2157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wes,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have such a file that was imported from dBase, and doesn't contain confidential info and hasn't been modified, I'd appreciate your sending me a copy (to art297 at rogers dot com).&amp;nbsp; I'm still investigating the matter, but have never confronted a "permanent format".&amp;nbsp; I would bet that there is still more to learn.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 Sep 2011 22:14:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15918#M2157</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-25T22:14:57Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15919#M2158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Art -&lt;/P&gt;&lt;P&gt;&amp;nbsp; "Permanent formats" are just formats that are permanently attached because they are defined in the datasets. As opposed to formats that you temporarily attach during a procedure by using a format statement.&lt;/P&gt;&lt;P&gt;- Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 Sep 2011 22:35:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15919#M2158</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-09-25T22:35:19Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15920#M2159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for enlightening me!&amp;nbsp; What I am concerned about is NOT that one has to define desired length and format changes but, instead, the behavior of the SAS Explorer.&amp;nbsp; When one only changes the length, it shows that both the length, format and informat has changed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That wouldn't qualify as a "bug" but, frankly, it is simply wrong!&amp;nbsp; Why give a user incorrect information?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 Sep 2011 22:40:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15920#M2159</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-25T22:40:23Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15921#M2160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use PROC DATASETS to modify variable characteristics, including formats.&amp;nbsp; Here is some sample code to play with:&lt;/P&gt;&lt;PRE&gt; 
data test;
&amp;nbsp; set sashelp.class;
&amp;nbsp; format Name $8. weight z5.1;
run;
title "Formatted values";
proc print; run;

/*Get a list of variable names in a macro variable*/
proc sql noprint;
select Name into :Varnames separated by ' '
&amp;nbsp; from dictionary.columns
&amp;nbsp; where libname='WORK' and memname='TEST';
quit;

/*Remove formats from all the variables*/
proc datasets library=work nolist;
&amp;nbsp; modify test;
&amp;nbsp; format &amp;amp;varnames;
quit;
title "After formats removed";
proc print; run;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 02:34:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15921#M2160</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2011-09-26T02:34:38Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15922#M2161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Art -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I think that the problem is that ViewTable does not distinguish between the formats that are defined in the dataset and those that it is using because of default behaviour.&amp;nbsp;&amp;nbsp; I would prefer that it just leave the format/informat attributes empty in that screen, as they are in the dataset.&amp;nbsp; If they must put in a default value then it should be marked in someway to distinguish between that and the value of the attribute that is in the dataset's metadata.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 05:28:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15922#M2161</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-09-26T05:28:55Z</dc:date>
    </item>
    <item>
      <title>Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15923#M2162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SASJedi.&lt;/P&gt;&lt;P&gt;There is no need to use dictionary table any more , directly use variable list _all_;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.class;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format Name $8. weight z5.1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;title "Formatted values";&lt;/P&gt;&lt;P&gt;proc print; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Remove formats from all the variables*/&lt;/P&gt;&lt;P&gt;proc datasets library=work nolist;&lt;/P&gt;&lt;P&gt;&amp;nbsp; modify test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format _all_;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;title "After formats removed";&lt;/P&gt;&lt;P&gt;proc print; run;&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;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 08:36:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/15923#M2162</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-09-26T08:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the length of a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/279954#M56501</link>
      <description>&lt;P&gt;Dear experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;on the basis of our explanation I am trying co change my data as it follows:&lt;/P&gt;&lt;P&gt;1. increase the length of the variable:&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;alter table DC.input_analysis_res&lt;BR /&gt;modify Default_value char(20) format=$20. informat=$20.;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. insert the string "&lt;SPAN&gt;No_def_v&lt;/SPAN&gt;"&lt;BR /&gt;/* set unique value in case of default value missing */&lt;BR /&gt;data DC.input_analysis_res; set DC.input_analysis_res; if Default_value in ('',' ','-','.') then Default_value='No_def_v';run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is wrong with it? I got in the new varibale only the first two digits, i.e. "No" without the rest "&lt;SPAN&gt;_def_v&lt;/SPAN&gt;"&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2016 12:07:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-length-of-a-character-variable/m-p/279954#M56501</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-06-24T12:07:49Z</dc:date>
    </item>
  </channel>
</rss>

