I am trying to use:
infile dlm='@@' dsd missover;
to copy a SAS code to a new location, but it truncated email address (there is an email address e.g. [email protected] in the SAS code), and only the username 'ABC' show up in the new code, and the '@xyz.com' part was truncated.
So i excluded the infile option
dlm='@@'
re-run the code, and the email address was read correctly, however some regular lines are missing.
Just wonder if some infile options I can try to read all the lines correctly, also read the email address correctly too.
thanks!
an example:
*91,87,95 [email protected] test hudpiwaHUOV0
97,,92% bmno[aej0i34hmbtgkoersw934bnrtui9sdobn vnbud9rw0aq598vnfjipa
njuio9rpep0snhtui9es000
from="[email protected]"
fjsui123,1,1 0 ;
data a;
infile "/.../email.xlsx"
missover dsd lrecl=32767 firstobs=1;* dlm='@'; * delimiter = '@@';
informat all $char50. ;
input all $ ;
pk=_n_;
run;
Looks like your data is using space as the delimiter.
Let's convert your example text into a file so we have something to test against.
filename txt temp;
options parmcards=txt;
parmcards4;
*91,87,95 [email protected] test hudpiwaHUOV0
97,,92% bmno[aej0i34hmbtgkoersw934bnrtui9sdobn vnbud9rw0aq598vnfjipa
njuio9rpep0snhtui9es000
from="[email protected]"
fjsui123,1,1 0 ;
;;;;
Now we can read the file and parse it into the individual "words".
data parse ;
infile txt dlm=' ' length=llen column=ccol ;
lineno+1;
do wordno=1 by 1 until(ccol>llen);
length word $200 ;
input word @ ;
output;
end;
run;
Results:
Obs lineno wordno word
1 1 1 *91,87,95
2 1 2 [email protected]
3 1 3 test
4 1 4 hudpiwaHUOV0
5 2 1 97,,92%
6 2 2 bmno[aej0i34hmbtgkoersw934bnrtui9sdobn
7 2 3 vnbud9rw0aq598vnfjipa
8 3 1 njuio9rpep0snhtui9es000
9 4 1 from="[email protected]"
10 5 1 fjsui123,1,1
11 5 2 0
12 5 3 ;
If you add the DSD option to the INFILE statement you will get more words since adjacent (or leading) spaces will indicate an empty word.