<?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: I have statement like this: Proc Sort data= in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738985#M230591</link>
    <description>Thanks for the response.&lt;BR /&gt;What that is used for? Just part of the name of following item?&lt;BR /&gt;Regards,&lt;BR /&gt;Blue Blue</description>
    <pubDate>Tue, 04 May 2021 16:50:55 GMT</pubDate>
    <dc:creator>GN0001</dc:creator>
    <dc:date>2021-05-04T16:50:55Z</dc:date>
    <item>
      <title>I have statement like this: Proc Sort data= &amp;kpa._this data  out=&amp;kpa._thisdata; by thisVar; Run;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738749#M230487</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I have:&lt;/P&gt;
&lt;P&gt;Proc Sort data= &amp;amp;kpa._this data out=&amp;amp;kpa._thisdata;&lt;/P&gt;
&lt;P&gt;by thisVar;&lt;/P&gt;
&lt;P&gt;Run;&lt;/P&gt;
&lt;P&gt;What does this &amp;amp; sign and the dot sign is?&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Blue Blue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 23:56:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738749#M230487</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-05-03T23:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: I have statement like this: Proc Sort data= &amp;kpa._this data  out=&amp;kpa._thisdata; by this</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738766#M230494</link>
      <description>&lt;P&gt;&amp;amp; marks the start of the macro variable KPA and the dot marks the end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the variable has a value of &lt;EM&gt;abc&lt;/EM&gt;, the line will be transformed to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;proc sort data=abc_this data&amp;nbsp; out=abc_thisdata;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 03:00:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738766#M230494</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-05-04T03:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: I have statement like this: Proc Sort data= &amp;kpa._this data  out=&amp;kpa._thisdata; by this</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738789#M230505</link>
      <description>Hello ChrisNZ,&lt;BR /&gt;Do we need an Undescore after dot to separate invoke of a Macro variable?&lt;BR /&gt;I searched a lot to see where the Macro variable is created in the code; I just found the call to Macro Variable but no trace of Macro creation.&lt;BR /&gt;Regards,&lt;BR /&gt;Blue Blue&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 04 May 2021 06:03:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738789#M230505</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-05-04T06:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: I have statement like this: Proc Sort data=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738790#M230506</link>
      <description>No. The underscore is not linked to the macro variable. &lt;BR /&gt;</description>
      <pubDate>Tue, 04 May 2021 06:24:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738790#M230506</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-05-04T06:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: I have statement like this: Proc Sort data=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738985#M230591</link>
      <description>Thanks for the response.&lt;BR /&gt;What that is used for? Just part of the name of following item?&lt;BR /&gt;Regards,&lt;BR /&gt;Blue Blue</description>
      <pubDate>Tue, 04 May 2021 16:50:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738985#M230591</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-05-04T16:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: I have statement like this: Proc Sort data= &amp;kpa._this data  out=&amp;kpa._thisdata; by this</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738993#M230596</link>
      <description>&lt;P&gt;The macro processor is a simple text replacement tool.&amp;nbsp; Especially when you are only talking about macro variable references, like in your example.&amp;nbsp; Once the text is replaced the resulting text is passed on to SAS to interpret and run the same as if the resulting text was what the program looked like to begin with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if you create a macro variable named PREFIX. For example by using a %LET statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let prefix=AAA;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then reference that macro variable in the middle of some other text in your program:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=&amp;amp;prefix._old ....&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The after the macro processor has finished processing the text your program will look like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=AAA_old ....&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So the underscore in this situation just becomes part of the name of the dataset being sorted.&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 17:46:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738993#M230596</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-04T17:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: I have statement like this: Proc Sort data= &amp;kpa._this data  out=&amp;kpa._thisdata; by this</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738996#M230598</link>
      <description>&lt;P&gt;Your posted code cannot work.&amp;nbsp; Most likely you have inserted an extra space or some other extra characters. Note that using the pop-up boxes for inserting code will make your posts easier to read since they will use fixed width fonts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's add multiple spaces between the words (tokens) in your statements to make it clearer there is something wrong:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc   sort   data=   &amp;amp;kpa._this   data   out=   &amp;amp;kpa._thisdata   ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So if KPA has the value FRED then this code expands to&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc   sort   data=   FRED_this   data   out=   FRED_thisdata   ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now it is very clear that there is an extra word "data" in there.&amp;nbsp; If we remove the space(s) between THIS and DATA then this call to PROC SORT is going to overwrite the original dataset with the sorted version of the dataset.&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 17:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/738996#M230598</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-04T17:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: I have statement like this: Proc Sort data= &amp;kpa._this data  out=&amp;kpa._thisdata; by this</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/739005#M230602</link>
      <description>Thanks for this great response.</description>
      <pubDate>Tue, 04 May 2021 18:05:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/739005#M230602</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-05-04T18:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: I have statement like this: Proc Sort data= &amp;kpa._this data  out=&amp;kpa._thisdata; by this</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/739020#M230603</link>
      <description>thanks it is resolved</description>
      <pubDate>Tue, 04 May 2021 18:10:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/739020#M230603</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-05-04T18:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: I have statement like this: Proc Sort data=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/739086#M230631</link>
      <description>Yes See the generated code.&lt;BR /&gt;</description>
      <pubDate>Tue, 04 May 2021 21:16:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-statement-like-this-Proc-Sort-data-amp-kpa-this-data-out/m-p/739086#M230631</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-05-04T21:16:56Z</dc:date>
    </item>
  </channel>
</rss>

