<?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: PROC SQL INTO: order of values when creating a macro variable out of a character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116867#M259413</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe before the SQL proc sort using options&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;sortseq=linguistic (numeric_collation=on)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Jun 2013 22:27:26 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2013-06-24T22:27:26Z</dc:date>
    <item>
      <title>PROC SQL INTO: order of values when creating a macro variable out of a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116861#M259407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a quite simple step in my progam, where I create a macro variable which should contain values of the variable NAME (character).&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="3743" alt="contents.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/3743_contents.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: navy; font-family: 'Courier New';"&gt;PROC&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: navy; font-family: 'Courier New';"&gt;SQL&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;NOPRINT&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt; UPCASE(name)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;INTO&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; :ListOfVars&amp;nbsp;&amp;nbsp;&amp;nbsp; SEPARATED &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;BY&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: purple; font-family: 'Courier New';"&gt;"# "&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;FROM&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; contents;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: navy; font-family: 'Courier New';"&gt;QUIT&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;&lt;SPAN lang="EN-US" style="font-size: 11pt; font-family: 'Calibri','sans-serif';"&gt;As a result I get the values of the NAME variable sorted as =&amp;gt; F1, F10, F11 etc. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;&lt;SPAN lang="EN-US" style="font-size: 11pt; font-family: 'Calibri','sans-serif';"&gt;&lt;SPAN lang="EN-US" style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;=====&amp;gt; List of variables&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : F1# F10# F11# F2# F3# F4# F5# F6# F7# F8# F9&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like PROC SQL to create the list of values in the sequence as the values are sorted in the dataset.&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 11pt; font-family: 'Calibri','sans-serif';"&gt;When adding a sorting variable VARNUM, I get the ordering I need, but also the WARNING "&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;INTO clause specifies fewer host variables than columns listed in the SELECT clause." &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: navy; font-family: 'Courier New';"&gt;PROC&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: navy; font-family: 'Courier New';"&gt;SQL&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;NOPRINT&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt; UPCASE(name),&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varnum&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;INTO&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; :ListOfVars&amp;nbsp;&amp;nbsp;&amp;nbsp; SEPARATED &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;BY&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: purple; font-family: 'Courier New';"&gt;"# "&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;FROM&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; contents&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;ORDER&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;BY&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt; varnum;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 10pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;QUIT&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;=====&amp;gt; List of variables&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : F1# F2# F3# F4# F5# F6# F7# F8# F9# F10# F11&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the time being, I added a macro variable name also for the VARNUM to avoid the WARNING, but I was wondering, if there is a way, maybe an option to control the ordering of values?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance,&lt;/P&gt;&lt;P&gt;Natalie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jun 2013 07:10:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116861#M259407</guid>
      <dc:creator>Natalie</dc:creator>
      <dc:date>2013-06-24T07:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INTO: order of values when creating a macro variable out of a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116862#M259408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;SPAN lang="EN-US" style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: navy;"&gt;PROC&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;SPAN lang="EN-US" style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: navy;"&gt;SQL&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;NOPRINT&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; UPCASE(name)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;INTO&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp; :ListOfVars&amp;nbsp;&amp;nbsp;&amp;nbsp; SEPARATED &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;BY&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: purple;"&gt;"# "&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp; contents&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;ORDER&lt;/SPAN&gt; &lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;BY&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; varnum;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: navy;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;QUIT&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;Richard&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jun 2013 09:08:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116862#M259408</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2013-06-24T09:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INTO: order of values when creating a macro variable out of a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116863#M259409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Richard,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes, it was my first idea, but then SAS brings the warning, that it can't find the variable in the SELECT-Statement: &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;WARNING: The query as specified involves ordering by an item that doesn't appear in its&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT clause. Since you are ordering the output of a SELECT DISTINCT it may&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;appear that some duplicates have not been eliminated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually, I think now the problem ist the DISTINCT selection. I removed DISTINCT (which I actually do not need at this step) and it runs ok!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Natalie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jun 2013 09:22:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116863#M259409</guid>
      <dc:creator>Natalie</dc:creator>
      <dc:date>2013-06-24T09:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INTO: order of values when creating a macro variable out of a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116864#M259410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There might be a tricky way to do this in one step.&amp;nbsp; But since your data sets will be small, I see no reason to make everything finish in one step instead of two.&amp;nbsp; You could try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; create table contents2 as select distinct name, varnum from contents order by varnum;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; select strip(name) into : ListofVars separated by '# ' from contents2;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;Note that DISTINCT was removing leading and trailing blanks, so the second SELECT applies the STRIP function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jun 2013 13:27:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116864#M259410</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-06-24T13:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INTO: order of values when creating a macro variable out of a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116865#M259411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would still expect you to get the warning&lt;/P&gt;&lt;P style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"&gt;WARNING: The query as specified involves ordering by an item that doesn't appear in its SELECT clause.&lt;/P&gt;&lt;P style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"&gt;However, that's just there to check you know what you are doing.&amp;nbsp; In this context it can be ignored.&lt;/P&gt;&lt;P style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"&gt;Another thought - maybe the DISTINCT was responsible for the unwanted order - SAS SQL will order output if it has to group, and you could argue DISTINCT is a form of grouping.&amp;nbsp; So try it without the DISTINCT and without the ORDER&amp;nbsp; BY.&lt;/P&gt;&lt;P style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"&gt;Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jun 2013 13:50:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116865#M259411</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2013-06-24T13:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INTO: order of values when creating a macro variable out of a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116866#M259412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Should it not be order by Name instead of varname?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jun 2013 14:30:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116866#M259412</guid>
      <dc:creator>esjackso</dc:creator>
      <dc:date>2013-06-24T14:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INTO: order of values when creating a macro variable out of a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116867#M259413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe before the SQL proc sort using options&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;sortseq=linguistic (numeric_collation=on)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jun 2013 22:27:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116867#M259413</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-06-24T22:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INTO: order of values when creating a macro variable out of a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116868#M259414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Adding the VARNUM to the SELECT list will suppress the warning, but you need to give it a macro variable name to write into.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN style="font-style: inherit;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-weight: inherit; font-style: inherit; font-size: 10pt; color: navy;"&gt;PROC&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-style: inherit;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-weight: inherit; font-style: inherit; font-size: 10pt; color: navy;"&gt;SQL&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; color: blue;"&gt;NOPRINT&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; color: black;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; color: blue;"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; color: black;"&gt;UPCASE(name)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; font-family: 'courier new', courier; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , varnum&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; color: blue;"&gt;INTO&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; color: black;"&gt; :ListOfVars SEPARATED &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; color: blue;"&gt;BY&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; color: purple;"&gt;"# "&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; color: purple;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , :dummy&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; color: blue;"&gt;FROM &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-style: inherit; font-size: 10pt; color: black;"&gt;contents&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-style: inherit; font-size: 10pt; color: blue;"&gt;ORDER&lt;/SPAN&gt; &lt;SPAN style="font-style: inherit; font-size: 10pt; color: blue;"&gt;BY&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; color: black;"&gt; varnum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="color: black; font-size: 10pt; font-style: inherit; font-family: 'courier new', courier;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN style="color: navy; font-size: 10pt; font-style: inherit;"&gt;&lt;STRONG&gt;QUIT&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; color: black;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2013 01:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116868#M259414</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-06-25T01:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INTO: order of values when creating a macro variable out of a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116869#M259415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;ORDER&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;BY&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt; input(substr(name,2),best8.);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2013 01:39:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116869#M259415</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-06-25T01:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INTO: order of values when creating a macro variable out of a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116870#M259416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Richard,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes, you are right, it's the DISTINCT-Statement, SAS needs to sort the variable and therefore I get the NAMEs in the macro variable as F1# F10# F11# F2# F3# F4# F5# F6# F7# F8# F9.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adding VARNUM to the ORDER-Statement did not bring any WARNINGs:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: navy; font-family: 'Courier New';"&gt;PROC&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: navy; font-family: 'Courier New';"&gt;SQL&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;NOPRINT&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;SELECT&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt; UPCASE(name)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;INTO&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; :ListOfVars&amp;nbsp;&amp;nbsp;&amp;nbsp; SEPARATED &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;BY&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: purple; font-family: 'Courier New';"&gt;"# "&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;FROM&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; contents&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;ORDER&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;BY&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt; varnum;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: navy; font-family: 'Courier New';"&gt;QUIT&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;%PUT&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt; %====&amp;gt; &amp;amp;ListOfVars.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, I can create distinct list and sort it beforehand and in the 2nd step create the macro variable, it then should be fine. But as I work with PROC CONTENTS to get the variable names, I realilsed now, that the DISTINCT selection is actually not necessary &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;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Natalie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2013 05:47:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116870#M259416</guid>
      <dc:creator>Natalie</dc:creator>
      <dc:date>2013-06-25T05:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INTO: order of values when creating a macro variable out of a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116871#M259417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ksharp,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks, good idea &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;....but I'm working on a macro, where I need to go through variables of a dataset and and they could be named different than f1-fx (in this case I read in an excel file with GETNAMES=NO).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Natalie&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2013 05:50:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116871#M259417</guid>
      <dc:creator>Natalie</dc:creator>
      <dc:date>2013-06-25T05:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INTO: order of values when creating a macro variable out of a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116872#M259418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;ORDER&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;BY&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt; input(compress(name, ,'kd'),best8.);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2013 06:32:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/116872#M259418</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-06-25T06:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INTO: order of values when creating a macro variable out of a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/889639#M351510</link>
      <description>&lt;P&gt;Yes , you are right using distinct, invoked sorting of values ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;If we want values to be inserted into macro variables in same order as in the dataset, don't use distinct.&lt;/P&gt;&lt;P&gt;It worked for me&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 12:33:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-order-of-values-when-creating-a-macro-variable-out/m-p/889639#M351510</guid>
      <dc:creator>sreyasg</dc:creator>
      <dc:date>2023-08-17T12:33:14Z</dc:date>
    </item>
  </channel>
</rss>

