BookmarkSubscribeRSS Feed
lbarwick
Quartz | Level 8

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!

15 REPLIES 15
s_lassen
Meteorite | Level 14

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.

lbarwick
Quartz | Level 8
The problem is that some lines are truncated at say column 100 and then other lines truncate at column 300. If it was S option would all lines be truncated at the same exact column?
s_lassen
Meteorite | Level 14

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.

lbarwick
Quartz | Level 8
I am not explicitly setting S option anywhere in the program. Is there an implicit S option too that is set in preferences?
s_lassen
Meteorite | Level 14

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;
lbarwick
Quartz | Level 8
So say someone with a local setting different from mine opened the program and then saved it, could that cause this?
s_lassen
Meteorite | Level 14

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.

lbarwick
Quartz | Level 8
OK - the proposed solution did not work. I'll check the configs.
Kurt_Bremser
Super User

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
Quartz | Level 8
I'm not sure what you mean. I am in a Windows environment using 9.4
lbarwick
Quartz | Level 8

Yes the lines are truncated in the enhanced editor.

Kurt_Bremser
Super User

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.

lbarwick
Quartz | Level 8
The code in text editor is identical to code in enhanced editor. There appears to be extraneous blank spaces inserted in random places. Unfortunately I made a minor edit the other day that wouldn't have affected any of this, so time stamp is unreliable. I've asked my IT dept to recover an archived copy.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 15 replies
  • 1441 views
  • 1 like
  • 3 in conversation