<?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 Obtaining Top Observations with SYMPUTX in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37269#M9466</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Linlin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; My Customer_ID is a numeric value, but I cannot use a SQL statement with this assignment. I have to use a SYMPUTX statement.&lt;/P&gt;&lt;P&gt; I understand that the SYMPUTX statement changes numeric to character.&lt;/P&gt;&lt;P&gt; Do you think it is possible to put a put statement once the macro is set up in order to convert it back to a numeric variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alisa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Mar 2012 16:18:22 GMT</pubDate>
    <dc:creator>InfoAlisaA</dc:creator>
    <dc:date>2012-03-20T16:18:22Z</dc:date>
    <item>
      <title>Obtaining Top Observations with SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37265#M9462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I am currently working with the following program for my homework assignment:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=orion.order_fact nway noprint; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; var Total_Retail_Price;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; class Customer_ID;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; output out=customer_sum sum=CustTotalPurchase;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=customer_sum ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by descending CustTotalPurchase;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=customer_sum(drop=_type_);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What the assignment is calling for is that I need to create a macro called TOP3 that contains the customer IDs of the top three customers after the sort of customer_sum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I created:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set customer_sum (firstobs=1 obs=3);&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symputx('TOP3',Customer_ID);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And this is my proc print statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=orion.customer_dim;&lt;/P&gt;&lt;P&gt;var Customer_ID Customer_Name Customer_Type;&lt;/P&gt;&lt;P&gt;where Customer_ID=&amp;amp;TOP3;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I try to run my proc print statement, I am only getting the last out of the top three observations from my macro.&lt;/P&gt;&lt;P&gt; I am not sure if set up my macro incorrectly or if I am doing my proc print statement incorrectly.&lt;/P&gt;&lt;P&gt; Could someone please take a look at my code and let me know where I am going wrong with my program?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alisa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 02:27:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37265#M9462</guid>
      <dc:creator>InfoAlisaA</dc:creator>
      <dc:date>2012-03-20T02:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Obtaining Top Observations with SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37266#M9463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your code, macro variable has been reassigned 3 times, in the end, it took the last value. You probaly will need;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; data _null_; &lt;/P&gt;&lt;P&gt;&amp;nbsp; length top3 $50;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do _n_=1 to 3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set customer_sum ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; top3=catx(', ', top3, Customer_ID);&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symputx('TOP3',top3);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select Customer_ID into :top3 separated by ' ,'&lt;/P&gt;&lt;P&gt;from customer_sum(obs=3);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit : to make your downstream code working:&lt;/P&gt;&lt;P&gt;proc print data=orion.customer_dim;&lt;/P&gt;&lt;P&gt;var Customer_ID Customer_Name Customer_Type;&lt;/P&gt;&lt;P&gt;where Customer_ID in (&amp;amp;TOP3);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 02:35:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37266#M9463</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-03-20T02:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Obtaining Top Observations with SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37267#M9464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; id c_id $;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;&amp;nbsp; 30 a&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;&amp;nbsp; 20 b&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;&amp;nbsp; 10 c&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;&amp;nbsp; 5 d&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;&amp;nbsp; 3 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 12pt;"&gt;/* if your ID is a character variable */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; have (obs=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;3&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;) end=last;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; top $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;60&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;retain&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; top;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; top=catx(&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 12pt;"&gt;','&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;,top,quote(trim(c_id)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; last &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; symputx(&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 12pt;"&gt;'top3'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;,top);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; &amp;amp;top3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;=have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; c_id in (&amp;amp;top3);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 12pt;"&gt;/* if ID is a num. variable */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;noprint&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; id &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;:top3 separated &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;by&lt;/SPAN&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 12pt;"&gt;','&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; have(obs=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;3&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; &amp;amp;top3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;=have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; id in (&amp;amp;top3);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 02:38:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37267#M9464</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-03-20T02:38:09Z</dc:date>
    </item>
    <item>
      <title>Obtaining Top Observations with SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37268#M9465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hai.kuo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I tried your code into my code, and unfortunately, with your data _null_ statement, I got all 75 records in the file and not just the first three. Unfortunately, I cannot use the SQL statement you provided since the assignment is calling for a symputx statement.&lt;/P&gt;&lt;P&gt; Also, I tried the proc print statement you provided, and it just provided only one observation. &lt;/P&gt;&lt;P&gt; If you have any other suggestions though, I would be open to them. &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;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alisa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 16:07:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37268#M9465</guid>
      <dc:creator>InfoAlisaA</dc:creator>
      <dc:date>2012-03-20T16:07:13Z</dc:date>
    </item>
    <item>
      <title>Obtaining Top Observations with SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37269#M9466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Linlin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; My Customer_ID is a numeric value, but I cannot use a SQL statement with this assignment. I have to use a SYMPUTX statement.&lt;/P&gt;&lt;P&gt; I understand that the SYMPUTX statement changes numeric to character.&lt;/P&gt;&lt;P&gt; Do you think it is possible to put a put statement once the macro is set up in order to convert it back to a numeric variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alisa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 16:18:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37269#M9466</guid>
      <dc:creator>InfoAlisaA</dc:creator>
      <dc:date>2012-03-20T16:18:22Z</dc:date>
    </item>
    <item>
      <title>Obtaining Top Observations with SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37270#M9467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;P.S.Also, I do not need to concatenate TOP to any of my Customer_IDs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 16:24:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37270#M9467</guid>
      <dc:creator>InfoAlisaA</dc:creator>
      <dc:date>2012-03-20T16:24:20Z</dc:date>
    </item>
    <item>
      <title>Obtaining Top Observations with SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37271#M9468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;P.S.Also, I do not need to concatenate TOP to any of my Customer_IDs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 16:24:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37271#M9468</guid>
      <dc:creator>InfoAlisaA</dc:creator>
      <dc:date>2012-03-20T16:24:32Z</dc:date>
    </item>
    <item>
      <title>Obtaining Top Observations with SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37272#M9469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alisa,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is odd. I have tried on Linlin's sample, and my code seems to work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;226&amp;nbsp; data _null_;&lt;/P&gt;&lt;P&gt;227&amp;nbsp;&amp;nbsp;&amp;nbsp; length top3 $50;&lt;/P&gt;&lt;P&gt;228&amp;nbsp;&amp;nbsp;&amp;nbsp; do _n_=1 to 3;&lt;/P&gt;&lt;P&gt;229&amp;nbsp;&amp;nbsp;&amp;nbsp; set have ;&lt;/P&gt;&lt;P&gt;230&amp;nbsp;&amp;nbsp;&amp;nbsp; top3=catx(', ', top3, c_ID);&lt;/P&gt;&lt;P&gt;231&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;232&amp;nbsp;&amp;nbsp;&amp;nbsp; call symputx('TOP3',top3);&lt;/P&gt;&lt;P&gt;233&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: There were 5 observations read from the data set WORK.HAVE.&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SYMBOLGEN:&amp;nbsp; Macro variable TOP3 resolves to a, b, c&lt;/P&gt;&lt;P&gt;234&lt;/P&gt;&lt;P&gt;235&amp;nbsp; %put &amp;amp;top3;&lt;/P&gt;&lt;P&gt;a, b, c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you sure you have applied _n_=1 to 3 loop?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or maybe let's get rid of the explixit loop and use 'retain':&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length top3 $50;&lt;/P&gt;&lt;P&gt;retain top3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set customer_sum (obs=3) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; top3=catx(', ', top3, Customer_ID);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; call symputx('TOP3',top3);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it works for you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 16:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37272#M9469</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-03-20T16:35:25Z</dc:date>
    </item>
    <item>
      <title>Obtaining Top Observations with SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37273#M9470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hai.kuo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I took a look at my code again and revised it so it works now. &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;Thanks for pointing this out to me. &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;Alisa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 16:53:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37273#M9470</guid>
      <dc:creator>InfoAlisaA</dc:creator>
      <dc:date>2012-03-20T16:53:04Z</dc:date>
    </item>
    <item>
      <title>Obtaining Top Observations with SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37274#M9471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Linlin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Here is my final code that produced the right answer:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=orion.order_fact nway noprint; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; var Total_Retail_Price;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; class Customer_ID;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; output out=customer_sum sum=CustTotalPurchase;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=customer_sum ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by descending CustTotalPurchase;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set customer_sum (obs=3) end=last;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; length top $16.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; retain top;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; top=catx(',',top,trim(Customer_ID));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if last then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symputx('toptest',top);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp; proc print data=orion.customer_dim;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var Customer_ID Customer_Name Customer_Type;&lt;/P&gt;&lt;P&gt;&amp;nbsp; where Customer_Id in (&amp;amp;toptest);&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your help!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alisa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 16:54:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37274#M9471</guid>
      <dc:creator>InfoAlisaA</dc:creator>
      <dc:date>2012-03-20T16:54:02Z</dc:date>
    </item>
    <item>
      <title>Obtaining Top Observations with SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37275#M9472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi Alisa,&lt;/P&gt;&lt;P&gt;Glad you solved your problem! to convert character to numeric, you need to use input:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; a=20;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;&amp;nbsp; b=input(&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 12pt;"&gt;"&amp;amp;a"&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;2.&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;put&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; b;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 17:13:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37275#M9472</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-03-20T17:13:36Z</dc:date>
    </item>
    <item>
      <title>Obtaining Top Observations with SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37276#M9473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not when the characters are already in a macro variable.&amp;nbsp; Remember that code generated by macros or macro variable expansion is treated by SAS just as if it had been typed into the original program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let a=20;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; b=&amp;amp;a ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; c=20;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both B and C will be numeric variables with the value of 20.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 17:23:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37276#M9473</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-20T17:23:59Z</dc:date>
    </item>
    <item>
      <title>Obtaining Top Observations with SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37277#M9474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thank you Tom!&amp;nbsp; - Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 17:31:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Obtaining-Top-Observations-with-SYMPUTX/m-p/37277#M9474</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-03-20T17:31:22Z</dc:date>
    </item>
  </channel>
</rss>

