0

I need to migrate some SAS code to Python, and I would like to have exactly the same results when I am sampling data. In SAS I have set a seed 12345, then I would like to know it there is way to get the same results when sampling in python . Is there a way to achieve this?

Kind regards.

  • Cannot be done unless you connect both to common program or interface to each other. See similar question between [Python and R](https://stackoverflow.com/q/22213298/1422451). If SAS can talk to lower-level C, build it there. – Parfait May 11 '18 at 18:17
  • Are you using SAS Viya? If so, its worth talking to SAS Tech Support. – Reeza May 13 '18 at 22:59
  • This sounds a lot like proof-of-function-via-comparison. If so, why not save your dataset in SAS and import it to Python and then run rest of code? – pinegulf May 14 '18 at 08:00

1 Answers1

0

Here are a few options, in approximate order of increasing development work required:

  1. Invoke SAS from python (or vice versa) to do your sampling.
  2. Implement the same sampling algorithm on both platforms. This might not be too bad if a very simple algorithm is sufficient for your purposes, e.g. something based on this.
  3. Implement a sampling algorithm in C that you can call from both platforms. SAS and python can talk to C to some extent, but this is probably quite a lot of work.
user667489
  • 9,501
  • 2
  • 24
  • 35