2

A client needs to convert some SAS code to Python and the engagement lead has asked me if it was possible to do this automatically. I found some tools that purport to do this but I am very skeptical of any tool which claims to automatically convert from one programming language to another, let alone something as domain specific as SAS.

I have not seen the source code we need to convert yet but my guess is that these tools will do some simplistic keyword conversions but any moderately complex logic will require so much tweaking as to make it easier to just re-write from scratch manually. Seems to me to be a rabbit hole we want to avoid.

Any thoughts? How realistic is doing any kind of automatic code conversion even as an "accelerator" for manual work?

1 Answer 1

1

Not possible. I have spent a lot of time in this area and I have yet to see a tool be able to do a code conversion. Also, I don't think it is a good idea regardless. There are structures that do not translate between the 2 and also serious logical differences. For example, handle this in python (pseudocode):

data test (keep=x where=(y>3));   
   set test1 test2 (where=(z>6.2));
      by age gender;
   if age > "&ageMax.";
   blah blah;
run;

&ageMax is a macro created by a proc sql from a database. That query comes from a %include that has a bunch of database calls in it.

I have done SAS to C# conversions and you have to have someone versed in both. Look at one screen, code in the other.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.