<?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: export to file text without headers issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307699#M65934</link>
    <description>&lt;P&gt;The 4 variables are probably alphanumeric, then their length sholud be defined as &amp;nbsp;$2 , $4 etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;your code with sliht change may do the work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;select 
Type_of_file &lt;STRONG&gt;length=$2&lt;/STRONG&gt; format=$2. informat=$char2. as Type_of_file,
Bank_no &lt;STRONG&gt;length=$4&lt;/STRONG&gt; format=$4. informat=$char4. as Bank_no,
Branch_no &lt;STRONG&gt;length=$4&lt;/STRONG&gt; format=$4. informat=$char4. as Branch_no,
Product &lt;STRONG&gt;length=$3&lt;/STRONG&gt; format=$3. informat=$char3. as Product ,&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;pay attention to the 'n after the variable name in the message:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;NOTE: Variable 'Type_of_file&amp;nbsp;&lt;STRONG&gt;'n&lt;/STRONG&gt; is uninitialized.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;SAS assumed the variable is of numeric type because you defined length=2 (instead $2);&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Oct 2016 17:22:12 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2016-10-27T17:22:12Z</dc:date>
    <item>
      <title>export to file text without headers issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307674#M65928</link>
      <description>&lt;P&gt;Hi People&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In few words, I'm trying to export a table composed by characters column to a unique text file with no headers and with each column assigned to a specific position in the text file, which has a ficed lenght&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the code is below. the first part of the code create the table, the second one is supposed to export the table to the text file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the issue is related to the first four columns. for some reason I get the following in the log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Variable 'Type_of_file&amp;nbsp;'n is uninitialized.&lt;BR /&gt;NOTE: Variable '&amp;nbsp;Bank_no&amp;nbsp;'n is uninitialized.&lt;BR /&gt;NOTE: Variable '&amp;nbsp;Branch_no&amp;nbsp;'n is uninitialized.&lt;BR /&gt;NOTE: Variable '&amp;nbsp;Product'n is uninitialized.&lt;BR /&gt;NOTE: The file '/intl/iccs_emea/dcortell/facturacion2.txt' is:&lt;BR /&gt;Filename=/intl/iccs_emea/dcortell/facturacion2.txt,&lt;BR /&gt;Owner Name=dcortell,Group Name=bis,&lt;BR /&gt;Access Permission=-rw-r--r--,&lt;BR /&gt;Last Modified=27Oct2016:08:10:16&lt;/P&gt;&lt;P&gt;NOTE: 14314 records were written to the file '/intl/iccs_emea/dcortell/facturacion2.txt'.&lt;BR /&gt;The minimum record length was 147.&lt;BR /&gt;The maximum record length was 147.&lt;BR /&gt;NOTE: There were 14314 observations read from the data set WORK.FACTURACIONTEXT.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.07 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So that the first four columns are not initialized and so the corresponding spaces in the txt files are not populated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The weird thing is that this happen also for others tables which I have tried to export in the same way to a text file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The export goes fine for all the others columns except as said for the first four.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;really no idea about what could cause this issue as&amp;nbsp;&lt;/P&gt;&lt;P&gt;a. the source table is created correctly&lt;/P&gt;&lt;P&gt;b. other colleagues of mine have run the same code without any problem regarding the first four colums&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any hints or help are welcomed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bests&lt;/P&gt;&lt;P&gt;Davide&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%_eg_conditional_dropds(WORK.facturaciontext);
proc sql;
create table facturaciontext as
select 
Type_of_file length=2 format=$2. informat=$char2. as Type_of_file,
Bank_no length=4 format=$4. informat=$char4. as Bank_no,
Branch_no length=4 format=$4. informat=$char4. as Branch_no,
Product length=3 format=$3. informat=$char3. as Product ,
Num_Contrato,
('00'||put(Sub_Tipo_Producto, z1.)) length=3 format=$3. informat=$char3. as Sub_tipo_Producto ,
Referencia_TRC,
currency length=3 format=$3. informat=$char3. as currency,
(put(year(Fecha_Alta),z4.) || put(month(Fecha_Alta),z2.) || put(day(Fecha_Alta), z2.)) length=8 format=$8. informat=$char8. as Fecha_Alta,
Monthly_spend length=15 format=$15. informat=$char15. as Monthly_spend ,
('+'||case when Average_spend is missing then "000000000000" else substr(put(Average_spend, z15.2),1,12) end||case when Average_spend is missing then "00" else
substr(put(Average_spend, z15.2),14,2)end)  length=15 format=$15. informat=$char15. as Average_spend ,
('+'||case when Last_year_annual_spend is missing then "000000000000" else substr(put(Last_year_annual_spend, z15.2),1,12)end||case when Last_year_annual_spend is missing then "00" else
substr(put(Last_year_annual_spend, z15.2),14,2) end) length=15 format=$15. informat=$char15. as Last_year_annual_spend,
('+'||case when Acumulated_annual_spend is missing then "000000000000" else substr(put(Acumulated_annual_spend, z15.2),1,12) end||case when Acumulated_annual_spend is missing then "00" else
substr(put(Acumulated_annual_spend, z15.2),14,2) end) length=15 format=$15. informat=$char15. as Acumulated_annual_spend  ,
('+'||case when Faturacion_Acumulada_Mes is missing then "000000000000" else substr(put(Faturacion_Acumulada_Mes, z15.2),1,12) end||
case when Faturacion_Acumulada_Mes is missing then "00" else substr(put(Faturacion_Acumulada_Mes, z15.2),14,2) end) length=15 format=$15. informat=$char15. as Faturacion_Acumulada_Mes,
Periodicty length=1 format=$1. informat=$char1. as Periodicity,
Fill_in,
Billing_date length=8 format=$8. informat=$char8. as Billing_date,
End_of_file
from work.facturacion t1;
quit;


data _null_ ;
set work.facturaciontext ;
file '/intl/iccs_emea/dcortell/facturacion2.txt' lrecl=148;

put @1 Type_of_file&amp;nbsp;+(-1) @3&amp;nbsp;Bank_no&amp;nbsp;+(-1) @7&amp;nbsp;Branch_no&amp;nbsp;+(-1) @11&amp;nbsp;Product +(-1) @14 Num_contrato +(-1) @21 Sub_Tipo_Producto +(-1) @24 Referencia_TRC
+(-1) @44 currency +(-1) @47 Fecha_Alta +(-1) @55 Monthly_spend +(-1) @70 Average_spend +(-1) @85 Last_year_annual_spend +(-1) @100 Acumulated_annual_spend +(-1)
+(-1) @115 Faturacion_Acumulada_Mes +(-1) @130 Periodicity +(-1) @131 Fill_in +(-1) @139 Billing_date +(-1) @147 End_of_file +(-1) ; 

run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Oct 2016 15:36:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307674#M65928</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2016-10-27T15:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: export to file text without headers issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307699#M65934</link>
      <description>&lt;P&gt;The 4 variables are probably alphanumeric, then their length sholud be defined as &amp;nbsp;$2 , $4 etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;your code with sliht change may do the work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;select 
Type_of_file &lt;STRONG&gt;length=$2&lt;/STRONG&gt; format=$2. informat=$char2. as Type_of_file,
Bank_no &lt;STRONG&gt;length=$4&lt;/STRONG&gt; format=$4. informat=$char4. as Bank_no,
Branch_no &lt;STRONG&gt;length=$4&lt;/STRONG&gt; format=$4. informat=$char4. as Branch_no,
Product &lt;STRONG&gt;length=$3&lt;/STRONG&gt; format=$3. informat=$char3. as Product ,&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;pay attention to the 'n after the variable name in the message:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;NOTE: Variable 'Type_of_file&amp;nbsp;&lt;STRONG&gt;'n&lt;/STRONG&gt; is uninitialized.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;SAS assumed the variable is of numeric type because you defined length=2 (instead $2);&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2016 17:22:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307699#M65934</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-10-27T17:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: export to file text without headers issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307704#M65935</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;NOTE: Variable 'Type_of_file&amp;nbsp;&lt;STRONG&gt;'n&lt;/STRONG&gt; is uninitialized.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;SAS assumed the variable is of numeric type because you defined length=2 (instead $2);&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;pay attention to the 'n after the variable name in the message:&amp;nbsp;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That syntax is for a name literal, not an indication of type.&amp;nbsp; Notice below that there appears to be a blank at the end of Type_of_file and at the beginning and end of Bank_no etc.&amp;nbsp; Those are actually 'A0'X the non-breaking space.&amp;nbsp; Where they came from and what it means to the OPs question I have no idea. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: Variable 'Type_of_file&amp;nbsp;'n is uninitialized.
NOTE: Variable '&amp;nbsp;Bank_no&amp;nbsp;'n is uninitialized.
NOTE: Variable '&amp;nbsp;Branch_no&amp;nbsp;'n is uninitialized.
NOTE: Variable '&amp;nbsp;Product'n is uninitialized.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Oct 2016 17:45:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307704#M65935</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-10-27T17:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: export to file text without headers issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307711#M65937</link>
      <description>&lt;P&gt;Hi Samule thank you for the reply but your suggestion seems not working: The log gives me error like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;27 Type_of_file length=$2 format=$2. informat=$char2. as Type_of_file,&lt;BR /&gt;_&lt;BR /&gt;22&lt;BR /&gt;200&lt;BR /&gt;28 Bank_no length=$4 format=$4. informat=$char4. as Bank_no,&lt;BR /&gt;_&lt;BR /&gt;22&lt;BR /&gt;200&lt;BR /&gt;29 Branch_no length=$4 format=$4. informat=$char4. as Branch_no,&lt;BR /&gt;_&lt;BR /&gt;22&lt;BR /&gt;200&lt;BR /&gt;30 Product length=$3 format=$3. informat=$char3. as Product ,&lt;BR /&gt;_&lt;BR /&gt;22&lt;BR /&gt;200&lt;BR /&gt;ERROR 22-322: Expecting an integer constant.&lt;/P&gt;&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In addition, the four column which are creating problems were created with the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table facturacion as&lt;BR /&gt;select&lt;BR /&gt;('50') length=2 format=$2. informat=$char2. as Type_of_file,&lt;BR /&gt;case when t1.santander=1 then '0049' else t1.Empresa_Banco end length=4 format=$4. informat=$char4. as Bank_no,&lt;BR /&gt;case when t1.santander=0 then '8840' else t1.Centro_Sucursal end length=4 format=$4. informat=$char4. as Branch_no,&lt;BR /&gt;('530') length=3 format=$3. informat=$char3. as Product,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So pretty sure they should have been identified as character by the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what do you think?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2016 18:00:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307711#M65937</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2016-10-27T18:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: export to file text without headers issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307721#M65941</link>
      <description>&lt;P&gt;Your errors are caused by non 7bit ASCII characters in your source code. &amp;nbsp;Change the 'A0'x characters back to blanks&amp;nbsp;and you perhaps can eliminate that strange messages about invalid or uninitalized varaibles.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you are working way too hard for this problem. Eliminate the SQL step and just write the text file directly from the source data.&lt;/P&gt;
&lt;P&gt;If your actual values are never too long for the space reserved for them then you might just need to use the&amp;nbsp;@ pointer control.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;
  set work.facturacion ;
  file '/intl/iccs_emea/dcortell/facturacion2.txt' lrecl=148;  
put
@1 Type_of_file
@3 Bank_no
@7 Branch_no
@11 Product
@14 Num_contrato
@21 Sub_Tipo_Producto
@24 Referencia_TRC
@44 currency
@47 Fecha_Alta
@55 Monthly_spend
@70 Average_spend
@85 Last_year_annual_spend
@100 Acumulated_annual_spend
@115 Faturacion_Acumulada_Mes
@130 Periodicity
@131 Fill_in
@139 Billing_date
@147 End_of_file
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you could use formatted PUT statement to force it to write the values in the space reserved or style desired.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put
...
@14 Num_Contrato Z3.
...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Oct 2016 18:32:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307721#M65941</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-10-27T18:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: export to file text without headers issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307729#M65945</link>
      <description>&lt;P&gt;Hi Tom&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry but from my point of view the sql step in necessary in order to convert some numeric columns to specific text values I need in the output file. Like, for isntance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(put(year(Fecha_Alta),z4.) || put(month(Fecha_Alta),z2.) || put(day(Fecha_Alta), z2.)) length=8 format=$8. informat=$char8. as Fecha_Alta,&lt;BR /&gt;Monthly_spend length=15 format=$15. informat=$char15. as Monthly_spend ,&lt;BR /&gt;('+'||case when Average_spend is missing then "000000000000" else substr(put(Average_spend, z15.2),1,12) end||case when Average_spend is missing then "00" else&lt;BR /&gt;substr(put(Average_spend, z15.2),14,2)end) length=15 format=$15. informat=$char15. as Average_spend&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These examples would be difficult to manage in a data step&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;About the&amp;nbsp;&lt;SPAN&gt;non 7bit ASCII characters in my code, can you provide some examples?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;As for my last post the 4 variables involved in this unitialized errors are defined like ex.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;('01') length=2 format=$2. informat=$char2. as Type,&lt;BR /&gt;case when t1.santander=1 then '0049' else t1.Empresa_Banco end length=4 format=$4. informat=$char4. as Bank_no,&lt;BR /&gt;case when t1.santander=0 then '8840' else t1.Centro_Sucursal end length=4 format=$4. informat=$char4. as Branch_no,&lt;BR /&gt;('530') length=3 format=$3. informat=$char3. as Product,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So not sure where the the characters your are mentiong are located. To me it seems pretty a declaration of character columns&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;in any case I post here the full code but pretty sure the code is fine&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table facturacion as
select 
('50') length=2 format=$2. informat=$char2. as Type_of_file,
case when t1.santander=1 then '0049' else t1.Empresa_Banco end length=4 format=$4. informat=$char4. as Bank_no,
case when t1.santander=0 then '8840' else t1.Centro_Sucursal end length=4 format=$4. informat=$char4. as Branch_no,
('530') length=3 format=$3. informat=$char3. as Product,
case when santander=0 then "9999999" else put(t1.Contract, z7.) end length=7 format=$7. informat=$char7. as Num_Contrato,
Sub_Tipo_Producto,
('99999999999999999999') length=20 format=$20. as Referencia_TRC,
('EUR') as currency,
t1.Fecha_Alta,
('+00000000000000') as Monthly_spend,
t2.Average_spend format=15.2,
t3.Last_year_annual_spend format=15.2,
t2.Acumulated_annual_spend format=15.2,
t4.Faturacion_Acumulada_Mes format=15.2,
('M') as Periodicty,
('        ') length=8 format=$8. as Fill_in,
(put(year(intnx('month', today(),&amp;amp;pastmonth,'e')),z4.) || put(month(intnx('month', today(),&amp;amp;pastmonth,'e')),z2.) || put(day(intnx('month', today(),&amp;amp;pastmonth,'e')), z2.)) as Billing_date,
('  ') length=2 format=$2. as End_of_file
from work.new_contract t1
left join work.ytdavg t2 on t1.acct11=t2.acct11 and t1.Fecha_Alta=t2.Fecha_Alta and t1.Fecha_Baja=t2.Fecha_Baja and t1.id_revised_fiscal2=t2.id_revised_fiscal2
left join work.lybb t3 on t1.acct11=t3.acct11 and t1.Fecha_Alta=t3.Fecha_Alta and t1.Fecha_Baja=t3.Fecha_Baja and t1.id_revised_fiscal2=t3.id_revised_fiscal2
left join work.mm t4 on t1.acct11=t4.acct11 and t1.Fecha_Alta=t4.Fecha_Alta and t1.Fecha_Baja=t4.Fecha_Baja and t1.id_revised_fiscal2=t4.id_revised_fiscal2;
quit;

%_eg_conditional_dropds(WORK.facturaciontext);
proc sql;
create table facturaciontext as
select 
Type_of_file length=2 format=$2. informat=$char2. as Type_of_file,
Bank_no length=4 format=$4. informat=$char4. as Bank_no,
Branch_no length=4 format=$4. informat=$char4. as Branch_no,
Product length=3 format=$3. informat=$char3. as Product ,
Num_Contrato,
('00'||put(Sub_Tipo_Producto, z1.)) length=3 format=$3. informat=$char3. as Sub_tipo_Producto ,
Referencia_TRC,
currency length=3 format=$3. informat=$char3. as currency,
(put(year(Fecha_Alta),z4.) || put(month(Fecha_Alta),z2.) || put(day(Fecha_Alta), z2.)) length=8 format=$8. informat=$char8. as Fecha_Alta,
Monthly_spend length=15 format=$15. informat=$char15. as Monthly_spend ,
('+'||case when Average_spend is missing then "000000000000" else substr(put(Average_spend, z15.2),1,12) end||case when Average_spend is missing then "00" else
substr(put(Average_spend, z15.2),14,2)end)  length=15 format=$15. informat=$char15. as Average_spend ,
('+'||case when Last_year_annual_spend is missing then "000000000000" else substr(put(Last_year_annual_spend, z15.2),1,12)end||case when Last_year_annual_spend is missing then "00" else
substr(put(Last_year_annual_spend, z15.2),14,2) end) length=15 format=$15. informat=$char15. as Last_year_annual_spend,
('+'||case when Acumulated_annual_spend is missing then "000000000000" else substr(put(Acumulated_annual_spend, z15.2),1,12) end||case when Acumulated_annual_spend is missing then "00" else
substr(put(Acumulated_annual_spend, z15.2),14,2) end) length=15 format=$15. informat=$char15. as Acumulated_annual_spend  ,
('+'||case when Faturacion_Acumulada_Mes is missing then "000000000000" else substr(put(Faturacion_Acumulada_Mes, z15.2),1,12) end||
case when Faturacion_Acumulada_Mes is missing then "00" else substr(put(Faturacion_Acumulada_Mes, z15.2),14,2) end) length=15 format=$15. informat=$char15. as Faturacion_Acumulada_Mes,
Periodicty length=1 format=$1. informat=$char1. as Periodicity,
Fill_in,
Billing_date length=8 format=$8. informat=$char8. as Billing_date,
End_of_file
from work.facturacion t1;
quit;


data _null_ ;
set work.facturaciontext ;
file '/intl/iccs_emea/dcortell/facturacion2.txt' lrecl=148;

put @1 Type_of_file&amp;nbsp;+(-1) @3&amp;nbsp;Bank_no&amp;nbsp;+(-1) @7&amp;nbsp;Branch_no&amp;nbsp;+(-1) @11&amp;nbsp;Product +(-1) @14 Num_contrato +(-1) @21 Sub_Tipo_Producto +(-1) @24 Referencia_TRC
+(-1) @44 currency +(-1) @47 Fecha_Alta +(-1) @55 Monthly_spend +(-1) @70 Average_spend +(-1) @85 Last_year_annual_spend +(-1) @100 Acumulated_annual_spend +(-1)
+(-1) @115 Faturacion_Acumulada_Mes +(-1) @130 Periodicity +(-1) @131 Fill_in +(-1) @139 Billing_date +(-1) @147 End_of_file +(-1) ; 

run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2016 18:55:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307729#M65945</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2016-10-27T18:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: export to file text without headers issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307741#M65952</link>
      <description>&lt;P&gt;Furthermore the weird stuff is that the issue persists aslo utilizing different data sources, still &amp;nbsp;on the first four columns only !!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;Table 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Variable 'Tipo_persona&amp;nbsp;'n is uninitialized.&lt;BR /&gt;NOTE: Variable '&amp;nbsp;Codigo_persona&amp;nbsp;'n is uninitialized.&lt;BR /&gt;NOTE: Variable '&amp;nbsp;Empresa_Banco&amp;nbsp;'n is uninitialized.&lt;BR /&gt;NOTE: Variable '&amp;nbsp;Centro_Sucursal'n is uninitialized.&lt;BR /&gt;NOTE: The file '/intl/iccs_emea/dcortell/contracto2.txt' is:&lt;BR /&gt;Filename=/intl/iccs_emea/dcortell/contracto2.txt,&lt;BR /&gt;Owner Name=dcortell,Group Name=bis,&lt;BR /&gt;Access Permission=-rw-r--r--,&lt;BR /&gt;Last Modified=27Oct2016:11:59:42&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 2&lt;/P&gt;&lt;P&gt;NOTE: Variable 'Type_of_file&amp;nbsp;'n is uninitialized.&lt;BR /&gt;NOTE: Variable '&amp;nbsp;Bank_no&amp;nbsp;'n is uninitialized.&lt;BR /&gt;NOTE: Variable '&amp;nbsp;Branch_no&amp;nbsp;'n is uninitialized.&lt;BR /&gt;NOTE: Variable '&amp;nbsp;Product'n is uninitialized.&lt;BR /&gt;NOTE: The file '/intl/iccs_emea/dcortell/comision.txt' is:&lt;BR /&gt;Filename=/intl/iccs_emea/dcortell/comision.txt,&lt;BR /&gt;Owner Name=dcortell,Group Name=bis,&lt;BR /&gt;Access Permission=-rw-r--r--,&lt;BR /&gt;Last Modified=27Oct2016:11:42:47&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2016 19:14:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/307741#M65952</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2016-10-27T19:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: export to file text without headers issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/308235#M66118</link>
      <description>&lt;P&gt;Hi People&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;no one with some solution in mind???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;Davide&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 10:32:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/308235#M66118</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2016-10-31T10:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: export to file text without headers issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/308247#M66120</link>
      <description>&lt;P&gt;Have you tried the solutions that were posted?&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 11:52:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/308247#M66120</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-10-31T11:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: export to file text without headers issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/308269#M66123</link>
      <description>&lt;P&gt;Hi Tom&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You said "Your errors are caused by non 7bit ASCII characters in your source code. &amp;nbsp;Change the 'A0'x characters back to blanks "; however not sure where the character are, if any, in my code. They are pretty standard text/number values.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regarding the part of skipping the sql step I can't , as per my code posted &amp;nbsp;above it is not just a mere "text" conversion of some columns, but include too some "case when" logics which apply to the final columns.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;furthermore, as hilighted there are some "details" (only first four columns of the table involved in the issue; the issue persisting also utilizing different text tables; the code working fine in sas base (i'm using EG)) that are make me wondering if it is not something related to the use of SAS EG only&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 13:22:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/308269#M66123</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2016-10-31T13:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: export to file text without headers issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/308276#M66128</link>
      <description>&lt;P&gt;It is hard to read the SQL code you posted, but the error message does not appear to be related to either the logic of your SQL step or the&amp;nbsp;logic in your attempt to write the fixed column data file. &amp;nbsp;Instead it looks like you have just referenced variables that do not exist in your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__﻿&lt;/a&gt;&amp;nbsp;pointed out your SAS log shows variable names using name literals that appear to have spaces or other non-printing characters as part of their names. &amp;nbsp;Why do your variable names need name literals? What is the source of these names? &amp;nbsp;Can you rename them to more normal names that use only alphanumerics and underscores?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;You need to find the source of the invalid variable names that the error is complaining about.&lt;/P&gt;
&lt;P&gt;Usually you do this by trying to reduce your example to miminal set of code that generates the error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you run a PROC CONTENTS on the data and see what variable names the data actual have? &amp;nbsp;You might try just running a simple report like PROC MEANS or PROC FREQ on one or two of the variables to make sure you can actually reference them in any way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have gotten past that issue then you can look into how to generate fixed format text file. &amp;nbsp;Note that you do NOT need to use SQL to manipulate data. &amp;nbsp;Manipulating data is the purpose of a DATA step! &amp;nbsp;Using conditional logic to manipulate data is not limited to CASE statements in SQL code.&amp;nbsp;You might want to use SQL if you are joining multiple tables in a complex way to create the data that you want to export or if you are using some drag and drop tool in EG to generate your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 14:12:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-to-file-text-without-headers-issue/m-p/308276#M66128</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-10-31T14:12:07Z</dc:date>
    </item>
  </channel>
</rss>

