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.
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.
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.
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;
@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?
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;
Thank You,
i am using proc export statement
eg:PROC 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
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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.