09-30-2014 05:15 AM
I want to create a text file from the sas dataset in which i want to write all variables in a record and all records continuously with out going to new line.
Here i'm able to write all recs continuously without going to new line, which is working fine if you see in the sample op file. end of the recs is actually ES02** in sample output file.
But when i see the output file, in between the end of rec (end of rec is mentioned with red mark @ ES02** in the below attached screen shot sample output file) its giving mutiple new lines and which is not at defined interval (i mean it not accuring in perticualr variable/length).
Also I attached the required data format(require output data) for your referance. Can someone please let me know how to resolve this newline character issue.
Thanks in advance.
09-30-2014 05:27 AM
Use the @@ to hold the line pointer:
a="djghkjsdhgkjh"; b="kllsdgjlks"; output;
a="jkhdkjshg"; b="ijgijopg"; output;
put a b @@;
10-16-2014 01:56 AM
I was using @@ but still there were new line charcters were introduced. So i got the solution and it is working fine now.
10-16-2014 02:45 AM
That is a bad programming approach.
Use the options in a language that are intended for that unless there are serious reasons.
The recfm is supporting what should happen at the end of each iteration.
There are other limitations:
-record definituon is not consistent
- char handling is limited to a maximum often 32k.
That is the visible sas buffer
10-16-2014 08:35 AM
As Jaap pointed out .it is a bad programming way. Let SAS do it for you.
data _null_; file 'c:\temp\x.txt' recfm=n; set sashelp.class; put name age sex; run;
10-28-2014 06:55 AM
If you read the documentation on records you will see there are several conventions being used for that. You should understand that and choose the appropriate one.
Why it is bad programming?
Well not understanding your data and your tools you are going into a trial/error development approach that can bring you into uncertain swamp area-s.
If you know utf8 (other encodings) type packed-type (zoned) and binary being stored physically incorrect transforms can harm all your data and processing.
Need further help from the community? Please ask a new question.