<?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: Creating Tab dlm file. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46086#M12221</link>
    <description>The PUT statement does not call for a concatenation nor an explicit delimiter, since you have the DLM= coded on the FILE statement.  And you will want to review the DSD option on the FILE statement.&lt;BR /&gt;
&lt;BR /&gt;
Also, if you have no data for the input file, you will have no header row, either.  You will want to code the header row PUT statement ahead of the SET statement to ensure at least a header row is generated.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Wed, 17 Jun 2009 21:18:47 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-06-17T21:18:47Z</dc:date>
    <item>
      <title>Creating Tab dlm file.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46082#M12217</link>
      <description>Hi, &lt;BR /&gt;
&lt;BR /&gt;
GoodMorning! &lt;BR /&gt;
I am trying to create a Tab dlm file using the file statement. &lt;BR /&gt;
&lt;BR /&gt;
Currently below is the code I am using&lt;BR /&gt;
data _null_;&lt;BR /&gt;
set A;&lt;BR /&gt;
file 'D:\final.txt'  delimiter ='09'X  ;&lt;BR /&gt;
put acct  scr ;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
My objective is to achieve 2 things&lt;BR /&gt;
1) Have a header, meaning coloumn names in the first row, using the above only the data is copied.&lt;BR /&gt;
2) I want scr to be right justified, is this possible.&lt;BR /&gt;
&lt;BR /&gt;
Appreciate any help!&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Tejeshwar</description>
      <pubDate>Wed, 17 Jun 2009 17:42:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46082#M12217</guid>
      <dc:creator>tejeshwar</dc:creator>
      <dc:date>2009-06-17T17:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Tab dlm file.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46083#M12218</link>
      <description>To add a header, include this line above the first put statement:&lt;BR /&gt;
&lt;BR /&gt;
PUT 'acct'||'09'x||'scr';&lt;BR /&gt;
&lt;BR /&gt;
I think (untested) that you can get scr to be right justified by using a $char format for it, as in&lt;BR /&gt;
&lt;BR /&gt;
FORMAT scr $char5.;</description>
      <pubDate>Wed, 17 Jun 2009 18:04:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46083#M12218</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-06-17T18:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Tab dlm file.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46084#M12219</link>
      <description>Thanks.&lt;BR /&gt;
Tried the below, SAS throwed an error.&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
set A;&lt;BR /&gt;
file 'D:\final.txt'  delimiter ='09'X  ;&lt;BR /&gt;
put 'acct'||'09'x||'scr';&lt;BR /&gt;
put  acct  scr ;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
               --&lt;BR /&gt;
               22&lt;BR /&gt;
                 -----&lt;BR /&gt;
                 200&lt;BR /&gt;
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, arrayname,&lt;BR /&gt;
              #, (, +, /, //, ;, @, @@, OVERPRINT, _ALL_, _BLANKPAGE_, _ODS_, _PAGE_.&lt;BR /&gt;
&lt;BR /&gt;
ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Also, If I just put put 'acct' in the first line, SAS is populating this btw each observation of data, something like &lt;BR /&gt;
&lt;BR /&gt;
acct&lt;BR /&gt;
123432133        323&lt;BR /&gt;
acct&lt;BR /&gt;
432233243        322&lt;BR /&gt;
&lt;BR /&gt;
Regards</description>
      <pubDate>Wed, 17 Jun 2009 18:24:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46084#M12219</guid>
      <dc:creator>tejeshwar</dc:creator>
      <dc:date>2009-06-17T18:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Tab dlm file.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46085#M12220</link>
      <description>try this, then.&lt;BR /&gt;
&lt;BR /&gt;
IF _N_ =1 THEN PUT 'accr'   'scr';&lt;BR /&gt;
&lt;BR /&gt;
The "IF _n_=1 THEN" clause will put out the row only once.</description>
      <pubDate>Wed, 17 Jun 2009 18:35:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46085#M12220</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-06-17T18:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Tab dlm file.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46086#M12221</link>
      <description>The PUT statement does not call for a concatenation nor an explicit delimiter, since you have the DLM= coded on the FILE statement.  And you will want to review the DSD option on the FILE statement.&lt;BR /&gt;
&lt;BR /&gt;
Also, if you have no data for the input file, you will have no header row, either.  You will want to code the header row PUT statement ahead of the SET statement to ensure at least a header row is generated.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 17 Jun 2009 21:18:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46086#M12221</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-06-17T21:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Tab dlm file.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46087#M12222</link>
      <description>Thanks Scott. &lt;BR /&gt;
I managed to write the below code and it accomplishes one of the objectives to get the header for this file but I still cant get Nw_L to right-justify in the output file&lt;BR /&gt;
&lt;BR /&gt;
    data _null_;&lt;BR /&gt;
    set  WORK.AB                                      end=EFIEOD;&lt;BR /&gt;
    %let _EFIERR_ = 0; /* set the ERROR detection macro variable */&lt;BR /&gt;
    %let _EFIREC_ = 0;     /* clear export record count macro variable */&lt;BR /&gt;
    file 'D:\ab.txt' delimiter='09'x DSD DROPOVER&lt;BR /&gt;
lrecl=32767;&lt;BR /&gt;
       format ACCT $20. ;&lt;BR /&gt;
       format AB_ID $10. ;&lt;BR /&gt;
       format CY_CD best12. ;&lt;BR /&gt;
       format Nw_L $7. ;&lt;BR /&gt;
	   format Type $1.;&lt;BR /&gt;
    if _n_ = 1 then        /* write column names */&lt;BR /&gt;
     do;&lt;BR /&gt;
       put&lt;BR /&gt;
       'ACCT'&lt;BR /&gt;
       '09'x&lt;BR /&gt;
       'AB_ID'&lt;BR /&gt;
       '09'x&lt;BR /&gt;
       'CY_CD'&lt;BR /&gt;
       '09'x&lt;BR /&gt;
	   'Nw_L'&lt;BR /&gt;
	   '09'x&lt;BR /&gt;
       'Type'&lt;BR /&gt;
       &lt;BR /&gt;
       &lt;BR /&gt;
       ;&lt;BR /&gt;
     end;&lt;BR /&gt;
     do;&lt;BR /&gt;
       EFIOUT + 1;&lt;BR /&gt;
       put ACCT $ @;&lt;BR /&gt;
       put AB_ID $ @;&lt;BR /&gt;
       put CY_CD @;&lt;BR /&gt;
       put Nw_L  @;&lt;BR /&gt;
       put Type $ ;&lt;BR /&gt;
       &lt;BR /&gt;
       ;&lt;BR /&gt;
     end;&lt;BR /&gt;
    if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */&lt;BR /&gt;
    if EFIEOD then call symputx('_EFIREC_',EFIOUT);&lt;BR /&gt;
    run;&lt;BR /&gt;
&lt;BR /&gt;
Any thoughts as to if/how we can accomplish that?&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Tejeshwar&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: tejeshwar

Message was edited by: tejeshwar</description>
      <pubDate>Thu, 18 Jun 2009 02:42:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46087#M12222</guid>
      <dc:creator>tejeshwar</dc:creator>
      <dc:date>2009-06-18T02:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Tab dlm file.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46088#M12223</link>
      <description>You should override the default alignment for the put statement (in your case -R option).&lt;BR /&gt;
&lt;BR /&gt;
put &lt;VARIABLE&gt; &lt;FORMAT&gt; -&lt;ALIGNMENT&gt;;&lt;BR /&gt;
&lt;BR /&gt;
for example: put X $10 -R; /* x right aligned in a 10 char space */&lt;BR /&gt;
&lt;BR /&gt;
Please, check online documentation here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000175758.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000175758.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/ALIGNMENT&gt;&lt;/FORMAT&gt;&lt;/VARIABLE&gt;</description>
      <pubDate>Thu, 18 Jun 2009 11:43:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46088#M12223</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-06-18T11:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Tab dlm file.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46089#M12224</link>
      <description>Thanks Daniel, &lt;BR /&gt;
&lt;BR /&gt;
This actually works in terms of right-justify but gives me some problem with the attribute after that attribute&lt;BR /&gt;
ex: if the data was &lt;BR /&gt;
acct         scr        type&lt;BR /&gt;
123432         234         B&lt;BR /&gt;
323246         36           C&lt;BR /&gt;
&lt;BR /&gt;
Now after right justifying scr, it becomes like &lt;BR /&gt;
acct         scr        type&lt;BR /&gt;
123432         234B&lt;BR /&gt;
323246           36C&lt;BR /&gt;
&lt;BR /&gt;
It seems its not able to create a tab dlm between the attribute which is right justify and the next value&lt;BR /&gt;
Any suggestions?&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: tejeshwar

Message was edited by: tejeshwar</description>
      <pubDate>Thu, 18 Jun 2009 12:15:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-Tab-dlm-file/m-p/46089#M12224</guid>
      <dc:creator>tejeshwar</dc:creator>
      <dc:date>2009-06-18T12:15:58Z</dc:date>
    </item>
  </channel>
</rss>

