<?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 Labor Day Weekend Puzzle in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180657#M34505</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="733023" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; suggested the answer to this puzzle earlier today on SAS-L. Since I never thought of doing what Matt suggested in the more than 40 years I have been using SAS, I thought it might be useful to see other's responses.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have the following dataset:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="color: #000000;"&gt;
&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; input a b c $ Zip d e f;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; cards; &lt;/P&gt;
&lt;P&gt;1 2 x 12345 6 7 8&lt;/P&gt;
&lt;P&gt;2 3 y 54321 7 8 9&lt;/P&gt;
&lt;P&gt;; &lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;You want a dataset called 'want' that only contains a b c d e and zip AND in that specific order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would be the easiest (i.e., least code and quickest running) way of accomplishing the task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. If you've Matt or have already seen Matt's SAS-L post, don't respond!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Aug 2014 23:05:00 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2014-08-29T23:05:00Z</dc:date>
    <item>
      <title>Labor Day Weekend Puzzle</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180657#M34505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="733023" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; suggested the answer to this puzzle earlier today on SAS-L. Since I never thought of doing what Matt suggested in the more than 40 years I have been using SAS, I thought it might be useful to see other's responses.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have the following dataset:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="color: #000000;"&gt;
&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; input a b c $ Zip d e f;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; cards; &lt;/P&gt;
&lt;P&gt;1 2 x 12345 6 7 8&lt;/P&gt;
&lt;P&gt;2 3 y 54321 7 8 9&lt;/P&gt;
&lt;P&gt;; &lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;You want a dataset called 'want' that only contains a b c d e and zip AND in that specific order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would be the easiest (i.e., least code and quickest running) way of accomplishing the task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. If you've Matt or have already seen Matt's SAS-L post, don't respond!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 23:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180657#M34505</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-08-29T23:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Labor Day Weekend Puzzle</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180658#M34506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want(drop=zip rename=f=zip);&lt;/P&gt;&lt;P&gt;set have; &lt;/P&gt;&lt;P&gt;f=zip;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 00:23:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180658#M34506</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-08-30T00:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Labor Day Weekend Puzzle</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180659#M34507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="2746" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: Impressive! But FriedEgg's solution was more generalizable and didn't require having a variable available with the same case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I won't post his solution just yet.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 00:47:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180659#M34507</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-08-30T00:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: Labor Day Weekend Puzzle</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180660#M34508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;retain a b c d e zip;&lt;/P&gt;&lt;P&gt;set have(drop=f); &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 01:05:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180660#M34508</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-08-30T01:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Labor Day Weekend Puzzle</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180661#M34509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;stat@sas: Yes, that would definitely work, but imagine if a thru e actually represented about 500 variables. However, good suggestion!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 01:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180661#M34509</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-08-30T01:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Labor Day Weekend Puzzle</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180662#M34510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All right then, how about:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data want;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set have(keep=a--c d--e); &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set have(keep=zip);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not quite as efficient, but more generalizable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 02:14:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180662#M34510</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-08-30T02:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Labor Day Weekend Puzzle</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180663#M34511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="2746" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: Close enough! FriedEgg's solution was an efficient way of doing the same thing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="color: #000000;"&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if 0 then set have (drop=zip keep=a--e);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set have (keep=a--e);&lt;/P&gt;
&lt;P&gt;run; &lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 02:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180663#M34511</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-08-30T02:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Labor Day Weekend Puzzle</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180664#M34512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Art! I agree, FriedEgg's solution is more efficient. - PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 02:54:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180664#M34512</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-08-30T02:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Labor Day Weekend Puzzle</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180665#M34513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Arthur.T ,&lt;/P&gt;&lt;P&gt;I think the fastest way is to create a view for that code ,and not to copy real table again. &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;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 12:38:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180665#M34513</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-08-30T12:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Labor Day Weekend Puzzle</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180666#M34514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="645292" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: Possibly. Compare the two on small, medium and large files and let us know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 13:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180666#M34514</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-08-30T13:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Labor Day Weekend Puzzle</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180667#M34515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's my/yet another approach:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* problem as stated ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; a b c $ Zip d e f;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: #FFFFC0;"&gt;1 2 x 12345 6 7 8&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: #FFFFC0;"&gt;2 3 y 54321 7 8 9&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;%let&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; vars=a b c d e zip;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; want1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &amp;amp;vars;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; have (&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;keep&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=&amp;amp;vars);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* more realistic example ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; b c $ f Zip d a e;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: #FFFFC0;"&gt;2 x 8 12345 6 1 7&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: #FFFFC0;"&gt;3 y 9 54321 7 2 8&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;%let&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; vars=a b c d e zip;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; want2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &amp;amp;vars;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; have (&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;keep&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=&amp;amp;vars);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;compare&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;base&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=want1 &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;compare&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=want2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* last approach, use a "skeleton" dataset as metadata ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5em; font-size: 11pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; skel;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; a b &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;8&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; c $&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;8&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; d e Zip &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;8&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* these must be in the desired order for the target dataset ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; missing(of _all_);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* could also add formats, labels, etc. ;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;stop&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;contents&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=skel &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=columns (keep=name &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;varnum&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;noprint&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;sql&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;noprint&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; name &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; :vars separated &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;by&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;" "&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; columns &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;order&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; varnum;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; want3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt; * if any of your metadata columns are derived columns (i.e. not in your source dataset) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt; * remember the implied retain on dataset variables, or this can come back to bite you! ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt; * IOW if skel contains a variable "foo" in order to set its PDV order, ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt; * and "foo" is calculated in the data step, remember that it is retained in the data step. ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;if&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;0&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; skel;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; have (&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;keep&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=&amp;amp;vars);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;compare&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;base&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=want1 &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;compare&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=want3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the problem as stated, where your source data has the PDV in almost the exact order you want in the target dataset, approaches such as variable lists may use less code.&amp;nbsp; However, they are prone to undesired results if the source data structure changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a perhaps more realistic example where the source data has its PDV in an order unrelated to the desired target dataset, you're gonna have to list the variables out.&amp;nbsp; If I had 500 variables, I'd proc print the data from proc contents output, reorder the variables in an editor, and create my program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The last example is yet another approach.&amp;nbsp; Not the least amount of code, but an approach I've sometimes used in the past.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Added comments about implied retain of dataset variables&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Sep 2014 01:52:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labor-Day-Weekend-Puzzle/m-p/180667#M34515</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2014-09-01T01:52:11Z</dc:date>
    </item>
  </channel>
</rss>

