data test; last_name = 'stanley jr.'; run; data _null_; file "my_file.txt" lrecl=119 TERMSTR=crlf; set test; put @1 last_name $26. ;run;
The customer receiving the file runs it through an outside program
For some reason it gives an invaild character message. It appears the
period at the end of Jr is causing the invalid character. Is there a
way to truncate the period at the end of the name if it exists to help avoid the invalid character
The question might be are there are any periods that you want to keep in that field.
Perhaps:
data test; last_name = 'stanley jr.'; last_name = compress(last_name,'.','t'); run;
which will remove all periods in the field.
Data design note: JR, SR, II, III, IV, 'the third' and such are not really part of a last name field and perhaps should be in a separate field.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.