BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
xizidememeda
Calcite | Level 5

Hi all!

 

I just have a very urgent question. I find that my SAS program gives different results when run different times. To be concrete, when I run it in this week (for several times), all the results are the same and consistent. However, after several days, like half a month, the results will change even I don't change anywhere (the same code and computer). The program includes several macros, but I check that there is no apparent mistake. 

 

Can you please tell me why this happens? Is there any problem?

 

I appreciate it very much for your warm help!

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @xizidememeda,

 

As mentioned by KurtBremser, two runs of the same program on the same input datasets and raw data files can give different results because (1) certain functions or procedures do so or because of (2) changes in the environment:

  1. Less obvious than date/time-dependent or random functions are changes of the observation order. In particular, PROC SQL can possibly deliver results in different orders if not otherwise specified. Among other things, observation order can have an impact on rounding errors in calculations (e.g., by PROC MEANS), which in turn can change the results of comparisons ("if a>b ...").
  2. The environment includes (in)format and function definitions, macros called, global macro variables, system options (e.g. SORTEQUALS), environment variables (e.g. SASAUTOS), external files, the SAS software itself (e.g. updates or hot fixes), other software involved, the operating system and programs running in parallel.

If I had to investigate this and no changes in the environment were known, my first step would be a thorough comparison of the log files. Needless to say, there must be no errors etc. Has the documented number of observations or variables changed anywhere? If not, I would pick one particular value which has changed significantly and trace it back meticulously all the way to the input data.

 

 

View solution in original post

4 REPLIES 4
andreas_lds
Jade | Level 19

The community is not the right place to discuss "urgent" matters. Contacting sas technical support is recommended. Because without the code and the complete logs, it is hardly possible to be of any assistance. And i am somewhat sure, that hardly anybody here has the time to analyse "several macros".

Kurt_Bremser
Super User

Same program + different results = different input data.

"input data" can be datasets or files that you import, but also the result of environment-dependent functions like TODAY().

ballardw
Super User

One wonders why if the results are expected to be the same why you are rerunning the "same code"?

 

 

FreelanceReinh
Jade | Level 19

Hi @xizidememeda,

 

As mentioned by KurtBremser, two runs of the same program on the same input datasets and raw data files can give different results because (1) certain functions or procedures do so or because of (2) changes in the environment:

  1. Less obvious than date/time-dependent or random functions are changes of the observation order. In particular, PROC SQL can possibly deliver results in different orders if not otherwise specified. Among other things, observation order can have an impact on rounding errors in calculations (e.g., by PROC MEANS), which in turn can change the results of comparisons ("if a>b ...").
  2. The environment includes (in)format and function definitions, macros called, global macro variables, system options (e.g. SORTEQUALS), environment variables (e.g. SASAUTOS), external files, the SAS software itself (e.g. updates or hot fixes), other software involved, the operating system and programs running in parallel.

If I had to investigate this and no changes in the environment were known, my first step would be a thorough comparison of the log files. Needless to say, there must be no errors etc. Has the documented number of observations or variables changed anywhere? If not, I would pick one particular value which has changed significantly and trace it back meticulously all the way to the input data.

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2957 views
  • 1 like
  • 5 in conversation