Desktop productivity for business analysts and programmers

Need to add footnotes\trailers in text document

Reply
New Contributor nr1
New Contributor
Posts: 4

Need to add footnotes\trailers in text document

Hi All,

 

 

I Need to add a  some text ( 'Note statements') at the end of my text file.

eg :

 

MBCE|WBSRV||||1305|19-07-2017|C|C|By /5346/JEESHMA B R|0||0|6250||6250|0|0|0|6250|190717FB139051
MBCE|WBSRV||||1305|19-07-2017|C|C|By /5013/AJAY VINOD|0||0|81250||81250|0|0|0|81250|190717FB141101

 

Note:'ALL DATA NOT REFLECTED IN REPORT'.

 

How to add this note statement.

Super User
Super User
Posts: 7,977

Re: Need to add footnotes\trailers in text document

Why, this is not inline with delimited text files?  First row contains headers (can be omitted), each following row is a row of data delimited by a given character - this breaks that and adds additional problems for the importer.  If you need to confirm something then this should be included in the manifest/import agreement/validation summary etc. not as part of the datafile.  This file would not pass my acceptance testing.

 

That being said, you will ignore all that and carry on anyway, so in your datastep which you write the data out (you do use datastep yes?) put:

data _null_;
  set have end=last;
  file "xyz.txt" dlm="|";
  ...
  if last then put "....";
run;

Again though, I would fail it as the datatype is not valid in any sense.

New Contributor nr1
New Contributor
Posts: 4

Re: Need to add footnotes\trailers in text document

Hi Sir,

 

Thanks for your response.

 

Yes i do have a data set which contains all the values.

 

data _null_;
  set have end=last;
  file "xyz.txt" dlm="|";
  ...
  if last then put "....";
run;
Now i have executed this code by giving my datset and in put statement the required lines.But only the last

line got excuted.data went missing and only the last line (in put statement)got printed.

Super User
Super User
Posts: 7,977

Re: Need to add footnotes\trailers in text document

This is just a shell code for example, you need to populate it with the data you have:

data _null_;
  set have end=last;
  file "xyz.txt" dlm="|";
  put var1 var2...;
  if last then put "....";
run;

 

Super User
Posts: 11,343

Re: Need to add footnotes\trailers in text document


nr1 wrote:

Hi All,

 

 

I Need to add a  some text ( 'Note statements') at the end of my text file.

eg :

 

MBCE|WBSRV||||1305|19-07-2017|C|C|By /5346/JEESHMA B R|0||0|6250||6250|0|0|0|6250|190717FB139051
MBCE|WBSRV||||1305|19-07-2017|C|C|By /5013/AJAY VINOD|0||0|81250||81250|0|0|0|81250|190717FB141101

 

Note:'ALL DATA NOT REFLECTED IN REPORT'.

 

How to add this note statement.


A question: Is this text file to be read by another computer program as input data? If so does that program know how to read a blank line followed by your note and NOT treat it as data?

 

 

Super User
Super User
Posts: 7,074

Re: Need to add footnotes\trailers in text document

Sounds like really dumb idea.

But if you really want to do it then just add it when you create the file.

Or you can just add it later in a sperate step. Let's assume your file is named 'myfile.txt'.

data _null_;
  file 'myfile.txt' mod ;
  put / "Note:'ALL DATA NOT REFLECTED IN REPORT'" ;
run;
New Contributor nr1
New Contributor
Posts: 4

Re: Need to add footnotes\trailers in text document

Thank You,

 

 

i am using proc export statement 

egSmiley TongueROC EXPORT DATA=a;

  OUTFILE= "location.txt"
DBMS=TAB replace;
putnames=no;
DELIMITER='|' ;
RUN;

 

this will give the data in txt format but need to add a footnote to this text file.any options for this

Super User
Super User
Posts: 7,977

Re: Need to add footnotes\trailers in text document

No.  Proc export will only create a valid delimited file, your not creating a valida delimited file so you need to do it yourself.  Also, you might want to clarify what you want out:

DBMS=TAB - this indicates a tab delimited text file however

DELIMTER='|' - this indicates a pipe delimited text file.

Also avoid coding in mixed case, it makes code hard to read and use code blocks - its the {i} above the post to avoid formatting issues.

Ask a Question
Discussion stats
  • 7 replies
  • 161 views
  • 0 likes
  • 4 in conversation