<?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: writing a macro with 4 parameters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317216#M69414</link>
    <description>&lt;P&gt;grad school level, but i'm in undergrad taking it.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2016 06:12:59 GMT</pubDate>
    <dc:creator>nrb</dc:creator>
    <dc:date>2016-12-07T06:12:59Z</dc:date>
    <item>
      <title>writing a macro with 4 parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/316943#M69329</link>
      <description>&lt;P&gt;Suppose we want to create several copies of a data set, but every time shuffled randomly.&amp;nbsp;&amp;nbsp; This task can be done with the following SAS program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data new; set old; index=RANUNI(seed);&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;Proc sort data=new;&lt;/P&gt;&lt;P&gt;By index;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;Data new; set new; drop index; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can we write a macro program with 4 parameters: input, nsets, seed, and output. “input” is the name of the existing data set, “nsets” is the number of randomly shuffled data sets, “seed” is an integer‐valued seed for RANUNI(), and “output” is the prefix of the names of randomly shuffled data sets.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2016 06:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/316943#M69329</guid>
      <dc:creator>nrb</dc:creator>
      <dc:date>2016-12-06T06:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: writing a macro with 4 parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/316949#M69332</link>
      <description>&lt;P&gt;Here's a good walk through in converting working code to a macro.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you follow the steps it's a straight forward process for your requirements. In fact I think the example in here is your other question....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi28/056-28.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi28/056-28.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2016 07:10:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/316949#M69332</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-06T07:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: writing a macro with 4 parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/316973#M69343</link>
      <description>&lt;P&gt;My first question would be why. &amp;nbsp;Its never a good idea to duplicate your data, you can assign the index values to variables, and then you can sort or process based on those variables. &amp;nbsp;Far simpler.&lt;/P&gt;
&lt;P&gt;Also, good idea to tidy up your code to make it readable e.g:&lt;/P&gt;
&lt;PRE&gt;data new; 
  set old; 
  index=ranuni(seed);
run;
proc sort data=new;
  by index;
run;
data new; 
  set new; 
  drop index; 
run;&lt;/PRE&gt;
&lt;P&gt;Makes it far easier to read.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2016 10:18:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/316973#M69343</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-12-06T10:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: writing a macro with 4 parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317050#M69359</link>
      <description>&lt;P&gt;Why not make ONE set of data with 4 index varaibles? Sort by a different index variable as desired.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2016 15:58:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317050#M69359</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-06T15:58:35Z</dc:date>
    </item>
    <item>
      <title>What would happen in this code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317201#M69440</link>
      <description>&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;let's say I have the code below&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; cork;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;input&lt;/SPAN&gt; tree$&lt;SPAN class="s4"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;-&lt;SPAN class="s4"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/SPAN&gt; north east south west;&lt;/P&gt;&lt;P class="p1"&gt;datalines;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;T1 72 66 76 77&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;T2 60 53 66 63&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;T3 56 57 64 58&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;T4 41 29 36 38&lt;/P&gt;&lt;P class="p3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN class="s3"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;The question is&amp;nbsp;Then, suppose you submit the following code.&lt;/P&gt;&lt;P class="p1"&gt;%RandomOrder(cork, 5, 0, outData)&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;what would happen in we printed this out?&lt;/P&gt;&lt;P class="p1"&gt;Proc print data=outData1;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;Run; Proc print data=outData2; &amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;The problem i'm having is that i'm putting the&amp;nbsp;&lt;SPAN&gt;%RandomOrder(cork, 5, 0, outData) below the run statement in the code presented above however it mentions "&lt;/SPAN&gt;Statement is not valid or it is used out of proper order"&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;Here's the full question&lt;/P&gt;&lt;P class="p1"&gt;Dataset contains 5 variables: tree, north, east, south, west. Read this data file into SAS. Suppose this SAS dataset name is ‘cork’. Then, suppose you submit the following code. %RandomOrder(cork, 5, 0, outData) Report the output of the following code: Proc print data=outData1;&amp;nbsp;&amp;nbsp;Run; Proc print data=outData2;&amp;nbsp;&amp;nbsp;Run;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 04:46:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317201#M69440</guid>
      <dc:creator>nrb</dc:creator>
      <dc:date>2016-12-07T04:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: What would happen in this code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317204#M69441</link>
      <description>&lt;P&gt;Without knowing what's in the macro RandomOrder we can't answer your question.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 04:58:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317204#M69441</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-07T04:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: writing a macro with 4 parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317208#M69410</link>
      <description>&lt;P&gt;So i'm converting the SAS code into a macro code? Can't I just replace the variables in the SAS code with the variables presented for the macro code?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 05:32:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317208#M69410</guid>
      <dc:creator>nrb</dc:creator>
      <dc:date>2016-12-07T05:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: writing a macro with 4 parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317211#M69411</link>
      <description>&lt;P&gt;As a starter, yes, for full points, no.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your macro needs to generate multiple data sets, which you won't get by just changing variable names. You need to create a loop or split the dataset somehow.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;“input” is the name of the existing data set,&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt; “nsets” is the number of randomly shuffled data sets&lt;/STRONG&gt;,&lt;/P&gt;
&lt;P&gt;“seed” is an integer‐valued seed for RANUNI(),&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;“output” is the prefix of the names of randomly shuffled data sets&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Out of curiousity, is this an undergrad, MBA, or grad school level course?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 05:42:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317211#M69411</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-07T05:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: What would happen in this code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317214#M69442</link>
      <description>&lt;P&gt;RUN; statemant should close each PROC or data step;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code should be like:&lt;/P&gt;
&lt;P class="p1"&gt;Proc print data=outData1;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;Run;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;Proc print data=outData2; &amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;run;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 06:05:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317214#M69442</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-12-07T06:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: What would happen in this code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317215#M69443</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel﻿&lt;/a&gt;&amp;nbsp;Although correct, that would leave the process hanging, not generate an error.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 06:08:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317215#M69443</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-07T06:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: writing a macro with 4 parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317216#M69414</link>
      <description>&lt;P&gt;grad school level, but i'm in undergrad taking it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 06:12:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317216#M69414</guid>
      <dc:creator>nrb</dc:creator>
      <dc:date>2016-12-07T06:12:59Z</dc:date>
    </item>
    <item>
      <title>Write a macro program with 4 parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317228#M69430</link>
      <description>&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;This is what I have tried to code but it's still incorrect and I need help leading towards the right direction&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; cork;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;input&lt;/SPAN&gt; Tree$&lt;SPAN class="s3"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;-&lt;SPAN class="s3"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt; North South East West;&lt;/P&gt;&lt;P class="p2"&gt;datalines&lt;SPAN class="s4"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;T1 72 66 76 77&lt;/P&gt;&lt;P class="p1"&gt;T2 60 53 66 63&lt;/P&gt;&lt;P class="p1"&gt;T3 56 57 64 58&lt;/P&gt;&lt;P class="p1"&gt;T4 41 29 36 38&lt;/P&gt;&lt;P class="p1"&gt;T5 32 32 35 36&lt;/P&gt;&lt;P class="p1"&gt;T6 30 35 34 26&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;%MACRO&lt;/STRONG&gt;&lt;/SPAN&gt; randomorder (input= ,nsets=, seed=, output=);&lt;/P&gt;&lt;P class="p1"&gt;PROC SORT DATA = input OUT = &lt;SPAN class="s5"&gt;"&amp;amp;output"&lt;/SPAN&gt;;&lt;/P&gt;&lt;P class="p1"&gt;seed=ranuni(seed);&lt;/P&gt;&lt;P class="p1"&gt;run;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;%MEND&lt;/STRONG&gt;&lt;/SPAN&gt; select;&lt;/P&gt;&lt;P class="p1"&gt;%&lt;STRONG&gt;&lt;I&gt;randomorder&lt;/I&gt;&lt;/STRONG&gt;(input=cork ,nsets=&lt;SPAN class="s3"&gt;&lt;STRONG&gt;5&lt;/STRONG&gt;&lt;/SPAN&gt;, seed=&lt;SPAN class="s3"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;, output=outdata1)&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;The question is asking&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;Suppose we want to create several copies of a data set, but every time shuffled randomly.&amp;nbsp;&amp;nbsp; This task can be done with the following SAS program.&lt;/P&gt;&lt;P class="p1"&gt;Data new;&lt;/P&gt;&lt;P class="p1"&gt;set old;&lt;/P&gt;&lt;P class="p1"&gt;index=RANUNI(seed);&lt;/P&gt;&lt;P class="p1"&gt;Run;&lt;/P&gt;&lt;P class="p1"&gt;Proc sort data=new;&lt;/P&gt;&lt;P class="p1"&gt;By index;&lt;/P&gt;&lt;P class="p1"&gt;Run;&lt;/P&gt;&lt;P class="p1"&gt;Data new;&lt;/P&gt;&lt;P class="p1"&gt;set new;&lt;/P&gt;&lt;P class="p1"&gt;drop index;&lt;/P&gt;&lt;P class="p1"&gt;run;&lt;/P&gt;&lt;P class="p1"&gt;(a) Write a macro program with 4 parameters: input, nsets, seed, and output. “input” is the name of the existing data set, “nsets” is the number of randomly shuffled data sets, “seed” is an integer‐valued seed for RANUNI(), and “output” is the prefix of the names of randomly shuffled data sets.&lt;/P&gt;&lt;P class="p1"&gt;B. Read the datalines It contains 5 variables: tree, north, east, south, west. Read this data file into SAS. Suppose this SAS dataset name is ‘cork’. Then, suppose you submit the following code. %RandomOrder(cork, 5, 0, outData).&amp;nbsp;Report the output of the following code: Proc print data=outData1;&amp;nbsp;&amp;nbsp;Run;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 07:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317228#M69430</guid>
      <dc:creator>nrb</dc:creator>
      <dc:date>2016-12-07T07:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Write a macro program with 4 parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317236#M69431</link>
      <description>&lt;P&gt;Before embarking on "macro-izing" code, you must make sure that the code is correct on its own.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SORT DATA = input OUT = "&amp;amp;output";
seed=ranuni(seed);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is not correct, as you can't set variables inside proc sort, and the sort misses the necessary by statement.&lt;/P&gt;
&lt;P&gt;ie&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort
  data=sashelp.class
  out=class
;
seed = ranuni(seed);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;renders this log:&lt;/P&gt;
&lt;PRE&gt;16         proc sort
17           data=sashelp.class
18           out=class
19         ;
20         seed = ranuni(seed);
           ____
           180
ERROR 180-322: Statement is not valid or it is used out of proper order.
21         run;
&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Dec 2016 08:15:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317236#M69431</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-12-07T08:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Write a macro program with 4 parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317241#M69432</link>
      <description>&lt;P&gt;Here's a push in the right direction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You posted the program you are aiming to replace with a macro. &amp;nbsp;You have to make sure the macro generates the same program. &amp;nbsp;For example, you need to begin by having the macro generate the equivalent of:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;Data new;&lt;/P&gt;
&lt;P class="p1"&gt;set old;&lt;/P&gt;
&lt;P class="p1"&gt;index=RANUNI(seed);&lt;/P&gt;
&lt;P class="p1"&gt;Run;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;To begin the macro, the code within would need to see something like this:&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;Data &amp;amp;output;&lt;/P&gt;
&lt;P class="p1"&gt;set &amp;amp;input;&lt;/P&gt;
&lt;P class="p1"&gt;index=RANUNI(&amp;amp;seed);&lt;/P&gt;
&lt;P class="p1"&gt;Run;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;Each time a macro variable appears, it would get replaced by the value passed to that parameter when the macro is called.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 08:38:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317241#M69432</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-12-07T08:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: What would happen in this code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317254#M69444</link>
      <description>&lt;P&gt;This is the third topic on exactly the same subject. &amp;nbsp;Please collect your questions and provide one post, with example test data in the form of a datastep, what the required output should be, and why. &amp;nbsp;Various examples have been provided to you, and the advice given has not been taken on board:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 09:34:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317254#M69444</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-12-07T09:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: What would happen in this code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317267#M69445</link>
      <description>&lt;P&gt;I merged two threads; if there's another about this topic, notify me, so I can also merge it in here.&lt;/P&gt;
&lt;P&gt;To the original poster: keep your posts about a topic in one thread, or helping you will become increasingly harder.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 11:24:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317267#M69445</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-12-07T11:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: What would happen in this code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317275#M69447</link>
      <description>&lt;P&gt;To note, as per previous posts I have made here, your code is very sloppy, and hence you are getting problems:&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; cork;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;input&lt;/SPAN&gt; tree$&lt;SPAN class="s4"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;-&lt;SPAN class="s4"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/SPAN&gt; north east south west;&lt;/P&gt;
&lt;P class="p1"&gt;datalines;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;T1 72 66 76 77&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;T2 60 53 66 63&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;T3 56 57 64 58&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;T4 41 29 36 38 &amp;nbsp; &amp;nbsp;&amp;lt;--- Where is the semicolon to finish this? &amp;nbsp;It may not be entirely necessary, but its bad coding!&lt;/P&gt;
&lt;P class="p3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN class="s3"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;The question is&amp;nbsp;Then, suppose you submit the following code.&lt;/P&gt;
&lt;P class="p1"&gt;%RandomOrder(cork, 5, 0, outData) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;--- again, where is the semicolon to finish this line, this looks like the cause of your issue as this line runs into the next.&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;what would happen in we printed this out?&lt;/P&gt;
&lt;P class="p1"&gt;Proc print data=outData1; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;Run; Proc print data=outData2; &amp;nbsp; &amp;lt;-- Why is this on the same line as the run; from the previous code, are you trying to hide code?&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;You can also make sure the macro itself exists at the time its called, i.e. somewhre before the call off %RandomOrder(), you need to have defined the macro with %macro RandomOrder;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;Of course, also bear in mind the other advice given here in that the process itself isnt good, don't duplicate data just to have a different sort - its wastes disk space and is inefficient coding. &amp;nbsp;Assign flag variables which can then be used in sorts.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 12:29:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-a-macro-with-4-parameters/m-p/317275#M69447</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-12-07T12:29:59Z</dc:date>
    </item>
  </channel>
</rss>

