<?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: Cannot locate the Macro output dataset in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523850#M4697</link>
    <description>&lt;P&gt;Thanks for your input.&lt;/P&gt;&lt;P&gt;Unfortunately I still cannot see the output.&lt;/P&gt;&lt;P&gt;LOG:&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 options mprint;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;74 %MACRO PSMatching(datatreatment= _MIPD_Yes, datacontrol= _MIPD_No, method=NN,&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 numberofcontrols= 3, caliper=0.2, replacement= no, out= matches);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76 %MEND PSMatching;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;77&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;91&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Sun, 30 Dec 2018 00:27:34 GMT</pubDate>
    <dc:creator>Jarot741</dc:creator>
    <dc:date>2018-12-30T00:27:34Z</dc:date>
    <item>
      <title>Cannot locate the Macro output dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523846#M4695</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am new to sas and therefore new to %MACRO.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am invoking a PSMatching MACRO and the code runs without any errors. However, I cannot locate the output.&lt;/P&gt;&lt;P&gt;Here is an example:&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;CODE:&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;%MACRO PSMatching(datatreatment= _MIPD_Yes, datacontrol= _MIPD_No, method=NN,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; numberofcontrols= 3, caliper=0.2, replacement= no, out= matches);&lt;BR /&gt;%MEND PSMatching;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;LOG:&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 %MACRO PSMatching(datatreatment= _MIPD_Yes, datacontrol= _MIPD_No, method=NN,&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 numberofcontrols= 3, caliper=0.2, replacement= no, out= matches);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 %MEND PSMatching;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;77 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;90&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;I am using SAS UE in a MAC. I checked and the version has MACRO enabled with :&lt;/P&gt;&lt;P&gt;PROC OPTIONS OPTION = MACRO;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;I would appreciate some help.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;J&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Dec 2018 23:45:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523846#M4695</guid>
      <dc:creator>Jarot741</dc:creator>
      <dc:date>2018-12-29T23:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot locate the Macro output dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523849#M4696</link>
      <description>&lt;P&gt;Add&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to the top of your code, and run it again. If the results are not obvious after this, then show us the new SAS log.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Dec 2018 00:12:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523849#M4696</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-12-30T00:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot locate the Macro output dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523850#M4697</link>
      <description>&lt;P&gt;Thanks for your input.&lt;/P&gt;&lt;P&gt;Unfortunately I still cannot see the output.&lt;/P&gt;&lt;P&gt;LOG:&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 options mprint;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;74 %MACRO PSMatching(datatreatment= _MIPD_Yes, datacontrol= _MIPD_No, method=NN,&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 numberofcontrols= 3, caliper=0.2, replacement= no, out= matches);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76 %MEND PSMatching;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;77&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;91&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 30 Dec 2018 00:27:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523850#M4697</guid>
      <dc:creator>Jarot741</dc:creator>
      <dc:date>2018-12-30T00:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot locate the Macro output dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523853#M4699</link>
      <description>&lt;P&gt;Okay, I see the problem, which I should have seen in your first post.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have simply defined an empty macro that has no code. Furthermore, you never actually run the macro, and so nothing happens, and nothing would happen because it is an empty macro anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you have made a mistake somewhere, you need to define the macro, or include macro PSMATCHING, which you haven't done (and you can't skip this step, nothing will work if you don't define the macro or include it), and then you should run this line of code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%PSMatching(datatreatment= _MIPD_Yes, datacontrol= _MIPD_No, method=NN, numberofcontrols= 3,
    caliper=0.2, replacement= no, out= matches)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Dec 2018 01:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523853#M4699</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-12-30T01:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot locate the Macro output dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523856#M4700</link>
      <description>&lt;P&gt;I see this macro is available in this Gobal Forum paper: &lt;A href="http://www2.sas.com/proceedings/forum2007/185-2007.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2007/185-2007.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The paper includes example code for running the macro (you were defining it not running it). To correctly run the macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Paste all of the SAS code in Appendix A into your SAS editor and run it. This will create the macro in SAS but not run it.&lt;/LI&gt;
&lt;LI&gt;Paste the following code into your SAS editor and run it. This now runs the macro using Treatment and Control datasets.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Treatment;
  input pscoreT idT ageT group;
datalines;
0.10 1 25 1
0.20 2 22 1
;
data Control;
  input pscoreC idC ageC group;
datalines;
0.07 3 45 0
0.08 4 37 0
0.11 5 20 0
0.45 6 27 0
0.47 7 47 0
;
run;

%PSMatching(datatreatment= Treatment, datacontrol= Control, method= NN&lt;BR /&gt;, numberofcontrols= 2, caliper=, replacement=no);

&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Dec 2018 03:18:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523856#M4700</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-12-30T03:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot locate the Macro output dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523888#M4708</link>
      <description>&lt;P&gt;Thank you so much! It is running now without issues!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One question:&lt;/P&gt;&lt;P&gt;PRE-Matching&lt;/P&gt;&lt;P&gt;My treatment cohort is 427 and the control 4079&lt;/P&gt;&lt;P&gt;POST-Matching&lt;/P&gt;&lt;P&gt;My treatment cohort is 1281 and the control 1281&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am wanting to do a 3:1 match, and not sure why I ended up with the last numbers.&lt;/P&gt;&lt;P&gt;This is the MACRO I am using by Marcelo Coca Perraillon Paper 185-2007&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro PSMatching(datatreatment=, datacontrol=,&lt;BR /&gt;method=, numberofcontrols=, caliper=,&lt;BR /&gt;&amp;nbsp;replacement=, out=);&lt;BR /&gt;&lt;BR /&gt;/* Create copies of the treated units if N &amp;gt; 1 */;&lt;BR /&gt;&amp;nbsp;data _Treatment0(drop= i);&lt;BR /&gt;&amp;nbsp; set &amp;amp;datatreatment;&lt;BR /&gt;&amp;nbsp; do i= 1 to &amp;amp;numberofcontrols;&lt;BR /&gt;&amp;nbsp; RandomNumber= ranuni(12345);&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;/* Randomly sort both datasets */&lt;BR /&gt;proc sort data= _Treatment0 out= _Treatment(drop= RandomNumber);&lt;BR /&gt;by RandomNumber;&lt;BR /&gt;run;&lt;BR /&gt;data _Control0;&lt;BR /&gt;set &amp;amp;datacontrol;&lt;BR /&gt;RandomNumber= ranuni(45678);&lt;BR /&gt;run;&lt;BR /&gt;proc sort data= _Control0 out= _Control(drop= RandomNumber);&lt;BR /&gt;by RandomNumber;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;data Matched(keep = IdSelectedControl PScoreControl MatchedToTreatID PScoreTreat);&lt;BR /&gt;&amp;nbsp; length pscoreC 8;&lt;BR /&gt;&amp;nbsp; length idC 8;&lt;BR /&gt;/* Load Control dataset into the hash object */&lt;BR /&gt;&amp;nbsp; if _N_= 1 then do;&lt;BR /&gt;declare hash h(dataset: "_Control", ordered: 'no');&lt;BR /&gt;declare hiter iter('h');&lt;BR /&gt;h.defineKey('idC');&lt;BR /&gt;h.defineData('pscoreC', 'idC');&lt;BR /&gt;h.defineDone();&lt;BR /&gt;call missing(idC, pscoreC);&lt;BR /&gt;end;&lt;BR /&gt;/* Open the treatment */&lt;BR /&gt;set _Treatment;&lt;BR /&gt;%if %upcase(&amp;amp;method) ~= RADIUS %then %do;&lt;BR /&gt;retain BestDistance 99;&lt;BR /&gt;%end;&lt;BR /&gt;/* Iterate over the hash */&lt;BR /&gt;rc= iter.first();&lt;BR /&gt;if (rc=0) then BestDistance= 99;&lt;BR /&gt;do while (rc = 0);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Caliper */&lt;BR /&gt;%if %upcase(&amp;amp;method) = CALIPER %then %do;&lt;BR /&gt;if (pscoreT - &amp;amp;caliper) &amp;lt;= pscoreC &amp;lt;= (pscoreT + &amp;amp;caliper) then do;&lt;BR /&gt;ScoreDistance = abs(pscoreT - pscoreC);&lt;BR /&gt;if ScoreDistance &amp;lt; BestDistance then do;&lt;BR /&gt;BestDistance = ScoreDistance;&lt;BR /&gt;IdSelectedControl = idC;&lt;BR /&gt;PScoreControl =&amp;nbsp; pscoreC;&lt;BR /&gt;MatchedToTreatID = idT;&lt;BR /&gt;PScoreTreat = pscoreT;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* NN */&lt;BR /&gt;%if %upcase(&amp;amp;method) = NN %then %do;&lt;BR /&gt;ScoreDistance = abs(pscoreT - pscoreC);&lt;BR /&gt;if ScoreDistance &amp;lt; BestDistance then do;&lt;BR /&gt;BestDistance = ScoreDistance;&lt;BR /&gt;IdSelectedControl = idC;&lt;BR /&gt;PScoreControl =&amp;nbsp; pscoreC;&lt;BR /&gt;MatchedToTreatID = idT;&lt;BR /&gt;PScoreTreat = pscoreT;&lt;BR /&gt;end;&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;%if %upcase(&amp;amp;method) = NN or %upcase(&amp;amp;method) = CALIPER %then %do;&lt;BR /&gt;rc = iter.next();&lt;BR /&gt;/* Output the best control and remove it */&lt;BR /&gt;if (rc ~= 0) and BestDistance ~=99 then do;&lt;BR /&gt;output;&lt;BR /&gt;%if %upcase(&amp;amp;replacement) = NO %then %do;&lt;BR /&gt;rc1 = h.remove(key: IdSelectedControl);&lt;BR /&gt;%end;&lt;BR /&gt;end;&lt;BR /&gt;%end;&lt;BR /&gt;/* Radius */&lt;BR /&gt;%if %upcase(&amp;amp;method) = RADIUS %then %do;&lt;BR /&gt;if (pscoreT - &amp;amp;caliper) &amp;lt;= pscoreC &amp;lt;= (pscoreT + &amp;amp;caliper) then do;&lt;BR /&gt;IdSelectedControl = idC;&lt;BR /&gt;PScoreControl =&amp;nbsp; pscoreC;&lt;BR /&gt;MatchedToTreatID = idT;&lt;BR /&gt;PScoreTreat = pscoreT;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;rc = iter.next();&lt;BR /&gt;%end;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;/* Delete temporary tables. Quote for debugging */&lt;BR /&gt;proc datasets;&lt;BR /&gt;delete _:(gennum=all);&lt;BR /&gt;&lt;BR /&gt;run;&lt;BR /&gt;&amp;nbsp;data &amp;amp;out;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set Matched;&lt;BR /&gt;&amp;nbsp;run;&lt;BR /&gt;%mend PSMatching;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I am invoking it :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%PSMatching(datatreatment=PNET._MIPD_YES, datacontrol=PNET._MIPD_NO,&lt;BR /&gt;method=NN, numberofcontrols=3, caliper=0.1, replacement=NO, out=MATCHES); RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;J&lt;/P&gt;</description>
      <pubDate>Sun, 30 Dec 2018 22:11:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523888#M4708</guid>
      <dc:creator>Jarot741</dc:creator>
      <dc:date>2018-12-30T22:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot locate the Macro output dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523906#M4710</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247921"&gt;@Jarot741&lt;/a&gt; - Sorry, the techniques used in these macros are not my area of expertise. I'll leave it up to someone who has more knowledge about this. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FYI, all I did was search SAS Support to find the macro then used an example in the paper to show how it is run. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Dec 2018 02:31:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-locate-the-Macro-output-dataset/m-p/523906#M4710</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-12-31T02:31:19Z</dc:date>
    </item>
  </channel>
</rss>

