<?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 Proc script to SQL in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Proc-script-to-SQL/m-p/857023#M82458</link>
    <description>&lt;P&gt;It look like you want us to do your job for you.&lt;/P&gt;
&lt;P&gt;First of all, why?&lt;/P&gt;
&lt;P&gt;I suggest you have a go yourself and return to us with specific problems, not a whole work task.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Feb 2023 12:42:14 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2023-02-03T12:42:14Z</dc:date>
    <item>
      <title>Convert SAS Proc script to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Proc-script-to-SQL/m-p/856996#M82456</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I need to convert SAS script to SQL, please assist.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table Entity as&lt;BR /&gt;select *&lt;BR /&gt;from goPRD.t_entity&lt;BR /&gt;where&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;UPCASE(TEN_NAME) LIKE 'T&amp;amp;R FAMILY%' OR&lt;BR /&gt;compress(ten_incorporation_number,'/\ABCDEFGHIJLNOPQRSTUVW')='37632013'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*FIC GLOBAL*/&lt;BR /&gt;proc sql;&lt;BR /&gt;create table ENT_FICGL as&lt;BR /&gt;SELECT *&lt;BR /&gt;FROM FICGL.MAAGeo&lt;BR /&gt;&lt;BR /&gt;where compress(InstitutionRegistrationNumber,'/\ABCDEFGHIJLNOPQRSTUVW') ='37632013' OR&lt;/P&gt;&lt;P&gt;upcase(ReportedCompanyName) like 'T&amp;amp;R FAMILY%'&lt;BR /&gt;&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;BR /&gt;PROC EXPORT DATA = ENT_FICGL&lt;BR /&gt;OUTFILE = "C:\SAS\MIRQT-220816-0000009\%sysfunc(date(),YYMMDD10.) - FICGLOBAL - Entities_STR_CTR.xlsx"&lt;BR /&gt;DBMS = XLSX&lt;BR /&gt;REPLACE;&lt;BR /&gt;SHEET = 'Detailed';&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table signatory as&lt;BR /&gt;select b.tac_account_id,&lt;BR /&gt;a.*&lt;BR /&gt;from Entity a left join goPRD.t_account b&lt;BR /&gt;on a.ten_entity_id =b.tac_entity_id&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;BR /&gt;data _ent;&lt;BR /&gt;set entity;&lt;BR /&gt;tac_account_id=ten_entity_id;&lt;BR /&gt;format Signatory $5.;&lt;/P&gt;&lt;P&gt;Signatory = "No";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data signatory;&lt;BR /&gt;set signatory _Ent;&lt;/P&gt;&lt;P&gt;if Signatory = "" then Signatory="Yes";&lt;/P&gt;&lt;P&gt;if tac_account_id ne .;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;options mlogic mprint mgen;&lt;BR /&gt;%macro TRANS() ;&lt;BR /&gt;data Persons_(keep=tac_account_id);&lt;BR /&gt;set signatory;&lt;BR /&gt;if tac_account_id ne .;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;set Persons_ end=eof;&lt;BR /&gt;n=_n_;&lt;BR /&gt;call symput("PR_Num"||compress(n),compress(tac_account_id));&lt;BR /&gt;if eof then call symput('nobs',_n_);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/*Check if dataset is EMPTY or not*/&lt;BR /&gt;/*If dataset is empty, process will stop*/&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select count(*) into :observations from Persons_;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;/*If it is empty*/&lt;BR /&gt;%if &amp;amp;observations. = 0 %then %do;&lt;BR /&gt;&lt;BR /&gt;data _NULL_;&lt;BR /&gt;tac_account_id=0;&lt;BR /&gt;n=_n_;&lt;BR /&gt;call symput("PR_Num"||compress(n),compress(tac_account_id));&lt;BR /&gt;call symput('nobs',_n_);&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;/*Destination*/&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE Sec_28_trans_dest AS&lt;BR /&gt;SELECT ttr_transaction_id&lt;BR /&gt;,ttr_transaction_number&lt;BR /&gt;,ttr_amount_local&lt;BR /&gt;,ttr_report_type&lt;BR /&gt;,ttr_source_party_id&lt;BR /&gt;,ttr_dest_party_id&lt;BR /&gt;,ttr_location&lt;BR /&gt;,ttr_date_transaction&lt;BR /&gt;,ttr_source_party_type&lt;BR /&gt;,ttr_dest_party_type&lt;BR /&gt;,ttr_source_country&lt;BR /&gt;,ttr_dest_country&lt;BR /&gt;FROM goPRD.t_transaction&lt;BR /&gt;WHERE&lt;/P&gt;&lt;P&gt;ttr_dest_party_id&lt;BR /&gt;IN&lt;BR /&gt;(&lt;BR /&gt;%do i=1 %to &amp;amp;nobs.;&lt;BR /&gt;&amp;amp;&amp;amp;PR_Num&amp;amp;i.&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;/*Source*/&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE Sec_28_trans_sour AS&lt;BR /&gt;SELECT ttr_transaction_id&lt;BR /&gt;,ttr_transaction_number&lt;BR /&gt;,ttr_amount_local&lt;BR /&gt;,ttr_report_type&lt;BR /&gt;,ttr_source_party_id&lt;BR /&gt;,ttr_dest_party_id&lt;BR /&gt;,ttr_location&lt;BR /&gt;,ttr_date_transaction&lt;BR /&gt;,ttr_source_party_type&lt;BR /&gt;,ttr_dest_party_type&lt;BR /&gt;,ttr_source_country&lt;BR /&gt;,ttr_dest_country&lt;BR /&gt;FROM goPRD.t_transaction&lt;BR /&gt;WHERE&lt;/P&gt;&lt;P&gt;ttr_source_party_id&lt;BR /&gt;IN&lt;BR /&gt;(&lt;BR /&gt;%do i=1 %to &amp;amp;nobs.;&lt;BR /&gt;&amp;amp;&amp;amp;PR_Num&amp;amp;i.&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;%mend TRANS;&lt;BR /&gt;%TRANS();&lt;/P&gt;&lt;P&gt;data sec_28_trns;&lt;BR /&gt;set Sec_28_trans_dest Sec_28_trans_sour;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table get_ent as&lt;BR /&gt;select a.ten_incorporation_number,&lt;BR /&gt;a.ten_entity_id,&lt;BR /&gt;a.ten_name,&lt;BR /&gt;a.Signatory,&lt;BR /&gt;b.*&lt;BR /&gt;from Signatory a right join sec_28_trns b&lt;BR /&gt;on a.tac_account_id = b.ttr_source_party_id&lt;BR /&gt;or a.tac_account_id = b.ttr_dest_party_id&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;/*Check if dataset is EMPTY or not*/&lt;BR /&gt;/*If dataset is empty, process will stop*/&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select count(*) into :observations from sec_28_trns;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;/*If it is empty*/&lt;BR /&gt;%if &amp;amp;observations. = 0 %then %do;&lt;/P&gt;&lt;P&gt;PROC EXPORT DATA = sec_28_trns&lt;BR /&gt;OUTFILE = "&amp;amp;folder.\%sysfunc(date(),YYMMDD10.) - &amp;amp;report_ref. Results - Entity_STR_CTR.xlsx"&lt;BR /&gt;DBMS = XLSX&lt;BR /&gt;REPLACE;&lt;BR /&gt;/* SHEET = 'Name_DOB_Match';*/&lt;BR /&gt;SHEET = 'Detailed data';&lt;BR /&gt;RUN;&lt;BR /&gt;PROC PRINTTO LOG = LOG;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;/*Continue if dataset not empty.*/&lt;BR /&gt;%if &amp;amp;observations. &amp;gt;= 1 %then %do;&lt;/P&gt;&lt;P&gt;%macro REPID() ;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;set sec_28_trns end=eof;&lt;BR /&gt;n=_n_;&lt;BR /&gt;call symput("TR_ID"||compress(n),compress(ttr_transaction_id));&lt;BR /&gt;call symput('nobs',_n_);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/*Check if dataset is EMPTY or not*/&lt;BR /&gt;/*If dataset is empty, process will stop*/&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select count(*) into :observations from sec_28_trns;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;/*If it is empty*/&lt;BR /&gt;%if &amp;amp;observations. = 0 %then %do;&lt;BR /&gt;&lt;BR /&gt;data _NULL_;&lt;BR /&gt;ttr_transaction_id=0;&lt;BR /&gt;n=_n_;&lt;BR /&gt;call symput("TR_ID"||compress(n),compress(ttr_transaction_id));&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;/*Destination*/&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE t_rep_party_ID AS&lt;BR /&gt;SELECT trt_transaction_id&lt;BR /&gt;,trt_report_id&lt;BR /&gt;FROM goPRD.t_report_transaction&lt;BR /&gt;WHERE&lt;/P&gt;&lt;P&gt;trt_transaction_id&lt;BR /&gt;IN&lt;BR /&gt;(&lt;BR /&gt;%do i=1 %to &amp;amp;nobs.;&lt;BR /&gt;&amp;amp;&amp;amp;TR_ID&amp;amp;i.&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*GET REPORT*/&lt;BR /&gt;data _null_;&lt;BR /&gt;set T_rep_party_id end=eof;&lt;BR /&gt;n=_n_;&lt;BR /&gt;call symput("TR_REP"||compress(n),compress(trt_report_id));&lt;BR /&gt;if eof then call symput('nobs',_n_);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/*Check if dataset is EMPTY or not*/&lt;BR /&gt;/*If dataset is empty, process will stop*/&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select count(*) into :observations from T_rep_party_id;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;/*If it is empty*/&lt;BR /&gt;%if &amp;amp;observations. = 0 %then %do;&lt;BR /&gt;&lt;BR /&gt;data _NULL_;&lt;BR /&gt;trt_report_id=0;&lt;BR /&gt;n=_n_;&lt;BR /&gt;call symput("TR_REP"||compress(n),compress(trt_report_id));&lt;BR /&gt;call symput('nobs',_n_);&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;/*Destination*/&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE t_rep_party_REP AS&lt;BR /&gt;SELECT tre_report_id,&lt;BR /&gt;tre_ref_number,&lt;BR /&gt;tre_reason,&lt;BR /&gt;tre_rentity_id,&lt;BR /&gt;tre_date&lt;BR /&gt;FROM goPRD.t_report&lt;BR /&gt;WHERE&lt;/P&gt;&lt;P&gt;tre_report_id&lt;BR /&gt;IN&lt;BR /&gt;(&lt;BR /&gt;%do i=1 %to &amp;amp;nobs.;&lt;BR /&gt;&amp;amp;&amp;amp;TR_REP&amp;amp;i.&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%mend REPID;&lt;BR /&gt;%REPID();&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table t_reps as&lt;BR /&gt;select a.*,&lt;BR /&gt;b.*&lt;BR /&gt;from T_rep_party_id a inner join T_rep_party_rep b&lt;BR /&gt;on a.trt_report_id=b.tre_report_id&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table sec28_rep as&lt;BR /&gt;select a.*,&lt;BR /&gt;b.*&lt;BR /&gt;from get_ent a inner join t_reps b&lt;BR /&gt;on a.ttr_transaction_id=b.trt_transaction_id&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;/*merge back*/&lt;/P&gt;&lt;P&gt;/*Get Banks*/&lt;BR /&gt;proc sql;&lt;BR /&gt;create table banks as&lt;BR /&gt;select *&lt;BR /&gt;from sqleft.Banks_information;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;/*Get Account information - Source*/&lt;BR /&gt;proc sql;&lt;BR /&gt;create table get_acc_source as&lt;BR /&gt;select a.*,&lt;BR /&gt;b.tac_account as Source_Account,&lt;BR /&gt;b.tac_bank_id as Source_Bank&lt;BR /&gt;from sec28_rep a left join goPRD.t_account b&lt;BR /&gt;on a.ttr_source_party_id = b.tac_account_id&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table get_acc_source as&lt;BR /&gt;select a.*,&lt;BR /&gt;b.tac_institution_name as Source_Bank_Name&lt;BR /&gt;from get_acc_source a left join banks b&lt;BR /&gt;on a.Source_Bank = b.tac_bank_id&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*Get Account information - Destination*/&lt;BR /&gt;proc sql;&lt;BR /&gt;create table get_acc_source as&lt;BR /&gt;select a.*,&lt;BR /&gt;b.tac_account as Destination_Account,&lt;BR /&gt;b.tac_bank_id as Destination_Bank&lt;BR /&gt;from get_acc_source a left join goPRD.t_account b&lt;BR /&gt;on a.ttr_dest_party_id = b.tac_account_id&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table get_acc_source as&lt;BR /&gt;select a.*,&lt;BR /&gt;b.tac_institution_name as Destination_Bank_Name&lt;BR /&gt;from get_acc_source a left join banks b&lt;BR /&gt;on a.Destination_Bank = b.tac_bank_id&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*Get reporter.*/&lt;BR /&gt;proc sql;&lt;BR /&gt;create table Report_reporter as&lt;BR /&gt;select a.*,&lt;BR /&gt;b.AI_RI_Number,&lt;BR /&gt;b.Business_Type_Group,&lt;BR /&gt;b.Agency_Name&lt;BR /&gt;from get_acc_source a left join sqleft.goAML_AI_RI b&lt;BR /&gt;on a.tre_rentity_id =b.goAML_Entity_ID&lt;/P&gt;&lt;P&gt;where ttr_report_type not in ("IRD" "AIF")&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table report_ind as&lt;BR /&gt;select a.*,&lt;BR /&gt;b.tri_indicator&lt;BR /&gt;from Report_reporter a left join goPRD.t_report_indicator b&lt;BR /&gt;on a.tre_report_id=b.tri_report_id&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;BR /&gt;proc sort data=report_ind nodupkey;by tre_report_id trt_transaction_id;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table report_indicator as&lt;BR /&gt;select a.*,b.lk_name&lt;BR /&gt;from report_ind a left join sqleft.REF_REPORT_INDICATOR_20181012 b&lt;BR /&gt;on a.tri_indicator=b.lk_code&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data FINAL_SEC28_ENTITY(drop= ten_entity_id ttr_transaction_id ttr_source_party_id ttr_dest_party_id trt_report_id Source_Bank Destination_Bank tre_report_id trt_transaction_id tpe_person_id&lt;BR /&gt;tpe_identification_no tri_indicator tre_rentity_id);&lt;/P&gt;&lt;P&gt;format ttr_source_party_type $20.;&lt;BR /&gt;format ttr_dest_party_type $20.;&lt;BR /&gt;set report_indicator;&lt;/P&gt;&lt;P&gt;if ttr_source_party_type = "E" then ttr_source_party_type = "Entity";&lt;BR /&gt;else if ttr_source_party_type = "P" then ttr_source_party_type = "Person";&lt;BR /&gt;else if ttr_source_party_type = "A" then ttr_source_party_type = "Account";&lt;/P&gt;&lt;P&gt;if ttr_dest_party_type = "E" then ttr_dest_party_type = "Entity";&lt;BR /&gt;else if ttr_dest_party_type = "P" then ttr_dest_party_type = "Person";&lt;BR /&gt;else if ttr_dest_party_type = "A" then ttr_dest_party_type = "Account";&lt;/P&gt;&lt;P&gt;/*ADD date for SAR*/&lt;BR /&gt;if ttr_date_transaction = . then ttr_date_transaction=tre_date;&lt;/P&gt;&lt;P&gt;ten_incorporation_number = compress(ten_incorporation_number,'/');&lt;/P&gt;&lt;P&gt;rename ten_name = Entity_Name;&lt;BR /&gt;rename ten_incorporation_number = Entity_Registration;&lt;BR /&gt;rename ttr_transaction_number = Transaction_No;&lt;BR /&gt;rename ttr_amount_local = Transaction_Amount;&lt;BR /&gt;rename ttr_report_type = Report_Type;&lt;BR /&gt;rename ttr_location = Transaction_Location;&lt;BR /&gt;rename ttr_date_transaction = Tranaction_Date;&lt;BR /&gt;rename tre_ref_number = Report_Ref;&lt;BR /&gt;rename tre_reason = Reason;&lt;BR /&gt;rename AI_RI_Number = Agency_Reg;&lt;BR /&gt;rename Business_Type_Group = Business_Group;&lt;BR /&gt;rename lk_name = Indicator;&lt;BR /&gt;rename ttr_source_party_type = Source_Party_Type;&lt;BR /&gt;rename ttr_dest_party_type = Destination_Party_Type;&lt;BR /&gt;rename ttr_source_country = Source_Country;&lt;BR /&gt;rename ttr_dest_country = Destination_Country;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data FINAL_SEC28_ENTITY;&lt;BR /&gt;retain Entity_Registration Entity_Name Signatory Report_Type Report_Ref Transaction_Amount Transaction_No Tranaction_Date Indicator Reason Agency_Reg Agency_Name Business_Group;&lt;BR /&gt;set FINAL_SEC28_ENTITY;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/*remove resubmitted information*/&lt;/P&gt;&lt;P&gt;proc sort data=FINAL_SEC28_ENTITY;by Transaction_No Transaction_Amount descending Report_Ref;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=FINAL_SEC28_ENTITY nodupkey;by Transaction_No Transaction_Amount;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*PLOT THE REPORT*/&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table EN_REP as&lt;BR /&gt;select Entity_Registration,Report_Type,sum(Transaction_Amount) as TOTAL_VALUE&lt;BR /&gt;from FINAL_SEC28_ENTITY&lt;BR /&gt;group by 1,2&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc transpose data=EN_REP out=trns_en;&lt;BR /&gt;by Entity_Registration;&lt;BR /&gt;id Report_Type;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;/*REMOVE DIFFERENT ENTITY NAMES*/&lt;/P&gt;&lt;P&gt;data _entities(keep=Entity_Registration Entity_Name);&lt;BR /&gt;set FINAL_SEC28_ENTITY;&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=_entities nodupkey;by Entity_Registration;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/*combine transposed data with entities to get entity name*/&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table summary_entities as&lt;BR /&gt;select a.*,&lt;BR /&gt;b.Entity_Name&lt;BR /&gt;from trns_en a left join _entities b&lt;BR /&gt;on a.Entity_Registration = b.Entity_Registration&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;data summary_entities(drop=_NAME_);&lt;BR /&gt;retain Entity_Registration Entity_Name;&lt;BR /&gt;set summary_entities;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;PROC PRINTTO LOG = "&amp;amp;folder.\Temp\Temp_Log.txt";&lt;BR /&gt;RUN;&lt;BR /&gt;PROC EXPORT DATA = summary_entities&lt;BR /&gt;OUTFILE = "C:\SAS\MIRQT-220816-0000009\%sysfunc(date(),YYMMDD10.) - goAML - Entities_STR_CTR.xlsx"&lt;BR /&gt;DBMS = XLSX&lt;BR /&gt;REPLACE;&lt;BR /&gt;SHEET = 'summary';&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;PROC EXPORT DATA = FINAL_SEC28_ENTITY&lt;BR /&gt;OUTFILE = "C:\SAS\MIRQT-220816-0000009\%sysfunc(date(),YYMMDD10.) - goAML - Entities_STR_CTR.xlsx"&lt;BR /&gt;DBMS = XLSX&lt;BR /&gt;REPLACE;&lt;BR /&gt;SHEET = 'Detailed';&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 07:06:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Proc-script-to-SQL/m-p/856996#M82456</guid>
      <dc:creator>Lindilethabo</dc:creator>
      <dc:date>2023-02-03T07:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Proc script to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Proc-script-to-SQL/m-p/857001#M82457</link>
      <description>&lt;P&gt;Which of the steps do you want to have as SQL code?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 09:04:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Proc-script-to-SQL/m-p/857001#M82457</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-02-03T09:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Proc script to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Proc-script-to-SQL/m-p/857023#M82458</link>
      <description>&lt;P&gt;It look like you want us to do your job for you.&lt;/P&gt;
&lt;P&gt;First of all, why?&lt;/P&gt;
&lt;P&gt;I suggest you have a go yourself and return to us with specific problems, not a whole work task.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 12:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Proc-script-to-SQL/m-p/857023#M82458</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-02-03T12:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Proc script to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Proc-script-to-SQL/m-p/857026#M82459</link>
      <description>&lt;P&gt;Most of that looks like it already is written in SQL.&amp;nbsp; Did you instead mean you want to translate it to run in some specific implementation of SQL?&amp;nbsp; If so which one?&amp;nbsp; What did you try?&amp;nbsp; It what ways did it not work?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 13:05:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Proc-script-to-SQL/m-p/857026#M82459</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-02-03T13:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Proc script to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Proc-script-to-SQL/m-p/857055#M82460</link>
      <description>&lt;P&gt;First of all, SAS doesn't directly translate to SQL. They are different languages and different structures. Every step needs to be redone. Some SQL appears to be there but it is SAS SQL (semi-related to ANSI but its own animal).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS language conversion is hard. Take it one step boundary at a time. Translate, test, see if the results match. However, SAS will not translate all the way to SQL. SAS can translate between languages (ex. Python, C#) but it is very, very hard work. SQL does not have the capabilities to handle all of SAS' constructs. You have macros in there making it even more enjoyable. Good luck.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 14:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Proc-script-to-SQL/m-p/857055#M82460</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2023-02-03T14:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Proc script to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Proc-script-to-SQL/m-p/871219#M82650</link>
      <description>&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":face_with_tears_of_joy:"&gt;😂&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":face_with_tears_of_joy:"&gt;😂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 17:58:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Proc-script-to-SQL/m-p/871219#M82650</guid>
      <dc:creator>vijaypratap0195</dc:creator>
      <dc:date>2023-04-21T17:58:39Z</dc:date>
    </item>
  </channel>
</rss>

