<?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: Efficiency Analysis: Run Analysis by year and region in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Efficiency-Analysis-Run-Analysis-by-year-and-region/m-p/905065#M357495</link>
    <description>&lt;P&gt;Your code is about SAS/OR,&lt;/P&gt;
&lt;P&gt;Better post it at OR forum:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Mathematical-Optimization/bd-p/operations_research" target="_blank"&gt;https://communities.sas.com/t5/Mathematical-Optimization/bd-p/operations_research&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;and calling&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Nov 2023 02:26:16 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2023-11-29T02:26:16Z</dc:date>
    <item>
      <title>Efficiency Analysis: Run Analysis by year and region</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficiency-Analysis-Run-Analysis-by-year-and-region/m-p/905060#M357492</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the following code from this community. When I run the code, it works but I find that it does not give efficiency scores by year and region. Any help would be greatly appreciated. Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data inputs;&lt;BR /&gt;input input $8.;&lt;BR /&gt;datalines;&lt;BR /&gt;staff&lt;BR /&gt;showroom&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data outputs;&lt;BR /&gt;input output $10.;&lt;BR /&gt;datalines;&lt;BR /&gt;beta_sales&lt;BR /&gt;profit&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data garage_data;&lt;BR /&gt;input garage_name $ year region $ staff showroom alpha_sales beta_sales profit;&lt;BR /&gt;datalines;&lt;BR /&gt;Winchester 2020 A 7 8 10 12 8.5 4 2 0.6 1.5&lt;BR /&gt;Andover 2020 A 6 6 20 30 9 4.5 2.3 0.7 1.6&lt;BR /&gt;Basingstoke 2020 B 2 3 40 40 2 1.5 0.8 0.25 0.5&lt;BR /&gt;Poole 2020 B 14 9 20 25 10 6 2.6 0.86 1.9&lt;BR /&gt;Winchester 2021 A 10 9 10 10 11 5 2.4 1 2&lt;BR /&gt;Andover 2021 A 24 15 15 13 25 19 8 2.6 4.5&lt;BR /&gt;Basingstoke 2021 B 6 7 50 40 8.5 3 2.5 0.9 1.6&lt;BR /&gt;Poole 2021 B 8 7.5 5 8 9 4 2.1 0.85 2&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=garage_data;&lt;BR /&gt;by year region;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data garage_data1;&lt;BR /&gt;set garage_data(keep=year region);&lt;BR /&gt;by year region;&lt;BR /&gt;if first.region;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro compute(year=,region=);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;proc optmodel ;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;set &amp;lt;str&amp;gt; INPUTS;&lt;BR /&gt;read data inputs into INPUTS=[input];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set &amp;lt;str&amp;gt; OUTPUTS;&lt;/P&gt;
&lt;P&gt;read data outputs into OUTPUTS=[output];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set &amp;lt;num&amp;gt; GARAGES ;&lt;/P&gt;
&lt;P&gt;str garage_name {GARAGES};&lt;BR /&gt;num input {INPUTS, GARAGES};&lt;BR /&gt;num output {OUTPUTS, GARAGES};&lt;BR /&gt;read data garage_data(where=(year=&amp;amp;year and region="&amp;amp;region")) into GARAGES=[_N_] garage_name&lt;BR /&gt;{i in INPUTS} &amp;lt;input[i,_N_]=col(i)&amp;gt;&lt;BR /&gt;{i in OUTPUTS} &amp;lt;output[i,_N_]=col(I)&amp;gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;num k;&lt;BR /&gt;num efficiency_number {GARAGES};&lt;BR /&gt;num weight_sol {GARAGES, GARAGES};&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var Weight {GARAGES} &amp;gt;= 0;&lt;BR /&gt;var Inefficiency &amp;gt;= 0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;max Objective = Inefficiency;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;con Input_con {i in INPUTS}:&lt;BR /&gt;sum {j in GARAGES} input[i,j] * Weight[j] &amp;lt;= input[i,k];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;con Output_con {i in OUTPUTS}:&lt;BR /&gt;sum {j in GARAGES} output[i,j] * Weight[j] &amp;gt;= output[i,k] * Inefficiency;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;do k = GARAGES;&lt;BR /&gt;solve;&lt;BR /&gt;efficiency_number[k] = 1 / Inefficiency.sol;&lt;BR /&gt;for {j in GARAGES}&lt;BR /&gt;weight_sol[k,j] = (if Weight[j].sol &amp;gt; 1e-6 then Weight[j].sol else .);&lt;BR /&gt;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;print garage_name efficiency_number;&lt;BR /&gt;create data efficiency_data from [garage] garage_name efficiency_number ;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;set garage_data1;&lt;BR /&gt;call execute(cats('%nrstr(%compute(year=',year,',region=',region,'))'));&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 00:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficiency-Analysis-Run-Analysis-by-year-and-region/m-p/905060#M357492</guid>
      <dc:creator>Zakir</dc:creator>
      <dc:date>2023-11-29T00:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiency Analysis: Run Analysis by year and region</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficiency-Analysis-Run-Analysis-by-year-and-region/m-p/905065#M357495</link>
      <description>&lt;P&gt;Your code is about SAS/OR,&lt;/P&gt;
&lt;P&gt;Better post it at OR forum:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Mathematical-Optimization/bd-p/operations_research" target="_blank"&gt;https://communities.sas.com/t5/Mathematical-Optimization/bd-p/operations_research&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;and calling&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 02:26:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficiency-Analysis-Run-Analysis-by-year-and-region/m-p/905065#M357495</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-11-29T02:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiency Analysis: Run Analysis by year and region</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficiency-Analysis-Run-Analysis-by-year-and-region/m-p/905142#M357516</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 11:28:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficiency-Analysis-Run-Analysis-by-year-and-region/m-p/905142#M357516</guid>
      <dc:creator>Zakir</dc:creator>
      <dc:date>2023-11-29T11:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiency Analysis: Run Analysis by year and region</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficiency-Analysis-Run-Analysis-by-year-and-region/m-p/905173#M357529</link>
      <description>&lt;P&gt;I answered there.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 14:50:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficiency-Analysis-Run-Analysis-by-year-and-region/m-p/905173#M357529</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2023-11-29T14:50:28Z</dc:date>
    </item>
  </channel>
</rss>

