<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Convert SAS Macros to Python and Spark, PySpark in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/538982#M148425</link>
    <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a block of code written in SAS programming using SAS macros.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to replicate the same functionality using PySpark, So I was thinking of writing a python function to replicate the logic.&lt;/P&gt;&lt;P&gt;Am i good here or is there anything in Python which is equivalent to SAS macros?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Feb 2019 14:34:07 GMT</pubDate>
    <dc:creator>kolanpaka</dc:creator>
    <dc:date>2019-02-27T14:34:07Z</dc:date>
    <item>
      <title>Convert SAS Macros to Python and Spark, PySpark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/538976#M148422</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anyone coded alternative for SAS Macros in python?&lt;/P&gt;&lt;P&gt;How can we develop SAS macro variables in Python?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 14:17:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/538976#M148422</guid>
      <dc:creator>kolanpaka</dc:creator>
      <dc:date>2019-02-27T14:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Macros to Python and Spark, PySpark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/538979#M148424</link>
      <description>&lt;P&gt;SAS and Python are totally different programming languages???&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can pass parameters into a SAS code, but would need to know a lot more information about what is driving one or the other, how its running etc.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 14:31:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/538979#M148424</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-02-27T14:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Macros to Python and Spark, PySpark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/538982#M148425</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a block of code written in SAS programming using SAS macros.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to replicate the same functionality using PySpark, So I was thinking of writing a python function to replicate the logic.&lt;/P&gt;&lt;P&gt;Am i good here or is there anything in Python which is equivalent to SAS macros?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 14:34:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/538982#M148425</guid>
      <dc:creator>kolanpaka</dc:creator>
      <dc:date>2019-02-27T14:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Macros to Python and Spark, PySpark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/538989#M148429</link>
      <description>&lt;P&gt;Sorry, going to repeat, Python and SAS are two different programming languages.&amp;nbsp; If you have code in one, there is no automatic convert from one to the other, any more than there is in any other language.&amp;nbsp; You would need to code the logic from one using the syntax and structures of the other.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for your other point, there are similar things like macro in other languages such as Python.&amp;nbsp; However its not completely the same.&amp;nbsp; Macro is simply a text generator.&amp;nbsp; If the text generated is valid SAS code, then that passes through the SAS compiler and is processed.&amp;nbsp; In Python there are packages for text generation - such as building generic code generated HTML pages, but something which exactly replicates what SAS macro does then no, not as far as I am aware.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 14:46:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/538989#M148429</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-02-27T14:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Macros to Python and Spark, PySpark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/539001#M148432</link>
      <description>&lt;P&gt;Do you know how to run the SAS macros, using SAS?&amp;nbsp; (Or do you know somebody who could do that for you?)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you were developing a new SAS macro, the typical process would be to construct a working SAS program that does the job, but needs to be generalized by adding flexible parameters.&amp;nbsp; I would suggest mirroring that process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;With the help of a programmer familiar with SAS macros, run the macro.&amp;nbsp; Use the MFILE / MPRINT options to obtain a copy of the source code generated, with all the macro language removed.&lt;/LI&gt;
&lt;LI&gt;Build a PySpark function to replicate this cast-in-concrete version of the program.&lt;/LI&gt;
&lt;LI&gt;Add flexibility to the PySpark function to support any needed flexibility.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;It's work, but I have seen it done this way (with Python, rather than PySpark).&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 14:55:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/539001#M148432</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-02-27T14:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Macros to Python and Spark, PySpark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/539034#M148449</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/191662"&gt;@kolanpaka&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am i good here or is there anything in Python which is equivalent to SAS macros?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A python package/library is the equivalent of a SAS macro, in terms of functionality and how it works.&lt;/P&gt;
&lt;P&gt;There is no automated way to convert a SAS macro to a Python script, your best bet is to deconstruct the logic and then implement that in python using the python approach to optimize things.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're using SAS Viya there are ways to use Python with SAS, but I suspect that's not what you're looking for. If you don't understand the SAS code, consider hiring a consultant to either provide the logic or do the conversion. Alternatively, the first two SAS programming courses are free - but macros are usually more complicated than those and those are considered advanced tasks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 16:23:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/539034#M148449</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-27T16:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Macros to Python and Spark, PySpark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/688142#M208998</link>
      <description>&lt;P&gt;It happens that many SAS programs are indeed a lot of chained PROC SQL.&lt;/P&gt;&lt;P&gt;It is quite easy in this case to use PySpark SQL feature (spark.sql()) to reuse these PROC SQL.&lt;/P&gt;&lt;P&gt;Of course SAS SQL is not compliant to SQL standard and you will have to adapt some functions / find the equivalent.&lt;/P&gt;&lt;P&gt;But you can leverage the logic, I have done it few times.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your SAS program does not use PROC SQL or for the other parts of your program, you will need to adapt and translate...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2020 09:24:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-SAS-Macros-to-Python-and-Spark-PySpark/m-p/688142#M208998</guid>
      <dc:creator>Herve_Mignot</dc:creator>
      <dc:date>2020-10-01T09:24:38Z</dc:date>
    </item>
  </channel>
</rss>

