<?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: proc sql lenght in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-lenght/m-p/351215#M63896</link>
    <description>&lt;P&gt;When you run your data step you're not updating B, you're creating a new version of it. I'm guessing in the Data Set A the variable has a length of 3? If you want to preserve the length of BH you need to include a length statement or just put length statements in your data step and drop the Proc SQL e.g.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table B
	(BH char(100));
quit;

data B;
	length BH $100;
	BH="BHBHBH";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 19 Apr 2017 10:17:40 GMT</pubDate>
    <dc:creator>ChrisBrooks</dc:creator>
    <dc:date>2017-04-19T10:17:40Z</dc:date>
    <item>
      <title>proc sql lenght</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-lenght/m-p/351213#M63895</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use proc sql to create a table B like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL;
CREATE TABLE B
(BA char(20),
BB char(10),
BC char(3),
BD char(6),
BE char(6),
BF char(6),
BG char(20),
BH char(100),
BI char(6),
BJ num(20,2));&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After I use a datastep to complete B according values of table A&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data B (keep= BA BB BC BD BE BF BG BH BI BJ);
set A;
array cols {*} _character_;
do i1 = 1 to dim(cols);
	BA = "BA";
	BB= "BB";
	BC= "BC";
	BD= "BD";
	BE= "BE";
	BF= "BF";
	BG= "BG";
	BJ= 0;
  do;
	BH = "BH1";
	BI= "BI1";
	output;
  end;  
  do;
	BH= "BH2BH2BH2BH2BH2BH2BH2";
	BI = "BI2";
	output;
  end; 
end;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is on BH. When I try to write&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;BH2BH2BH2BH2BH2BH2BH2&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;It is outputing:&lt;/P&gt;&lt;PRE&gt;BH2&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the lenght of the field is 3...&lt;/P&gt;&lt;P&gt;Whereas I specified it like char(100)...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know what can happen here?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 10:02:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-lenght/m-p/351213#M63895</guid>
      <dc:creator>fabdu92</dc:creator>
      <dc:date>2017-04-19T10:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql lenght</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-lenght/m-p/351215#M63896</link>
      <description>&lt;P&gt;When you run your data step you're not updating B, you're creating a new version of it. I'm guessing in the Data Set A the variable has a length of 3? If you want to preserve the length of BH you need to include a length statement or just put length statements in your data step and drop the Proc SQL e.g.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table B
	(BH char(100));
quit;

data B;
	length BH $100;
	BH="BHBHBH";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Apr 2017 10:17:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-lenght/m-p/351215#M63896</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2017-04-19T10:17:40Z</dc:date>
    </item>
  </channel>
</rss>

