I'm curious if anyone has experience with SAS file corruption, specifically lines of code randomly being partially deleted. For example, I have several programs that run as scheduled tasks and I noticed them failing all of a sudden.After opening the programs I noticed some comments had been truncated leaving them open, and also some lines of code being truncated, e.g.:
proc transpose data=metafree out=metatrans1free prefix=field; by projid prot table_name screenname; var field_name; run;
changed to:
proc transpose data=metafree out=metatrans1free prefix=field; by projid prot table_name
Only I have access to the program so it's not a matter of someone going in and accidentally altering these lines of code.
Thanks!
Probably something with the S option, which controls the length of source lines being read. Just specify
options s=max;
in the beginning of your code, that should solve the problem (unless your programs set the S option to something else along the way).
If you are using %INCLUDE files, you may also want to set S2=MAX.
Yes, that should be the case. Unless you explicitly set the S option somewhere, or you are using %INCLUDE, and S2 is different from S.
Yes, there may be a default set in Config.sas, in the program invocation command line, or in the autoexec.sas file. If you have no S or S2 options statements anywhere else, try putting this in the beginning of the programs you are running:
options s=max s2=max;
No. But if someone (including yourself) ran the program with a different config.sas, autoexec.sas, or different command line options, that could explain the problem. When running in batch, all of these may be different, check the batch environment, or try my proposed solution.
Are these lines truncated in the stored programs (do not check this with SAS, use the operating system for this - type (Windows) or cat (UNIX)), or only while being executed by SAS job?
@lbarwick wrote:
I'm not sure what you mean. I am in a Windows environment using 9.4
Then open the .sas files with the Windows Editor and check if the lines are truncated there.
Yes the lines are truncated in the enhanced editor.
And also in the Windows Editor (or Notepad++)? This will determine if the problem happens only when reading the files, or when they were last stored.
If the latter, look at the last modification timestamp; it might give you a hint when it happened.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.