<?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: Query builder automatically selects only distinct values from raw data in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151341#M11858</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not intended and unconventional.&amp;nbsp; Generally, the purpose is to reference data sets, and variables not to include the raw data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to go this route add a step that selects all the values into a macro variable and use that in your function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Feb 2015 17:43:30 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-02-03T17:43:30Z</dc:date>
    <item>
      <title>Query builder automatically selects only distinct values from raw data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151338#M11855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to use the Query Builder to write a percentile (PCTL) function pseudo-manually, where I want to use a column of data from my data set in the expression (since the PTCL function requires the raw data from which you want to calculate the percentile). [Note: I'm finding the 25th percentile in this example, which I know can be done in other ways in EG, but I am wondering about this in general for percentiles not "offered" by Summary Statistics in the Tasks &amp;gt; Describe menu. It also applies to using the raw data in the Query Builder in general.]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To do this, I do the following:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Start at the Input Data window&lt;/LI&gt;&lt;LI&gt;Select Query Builder&lt;/LI&gt;&lt;LI&gt;Drag my variable of interest (column called Length) over to to the Select Data pane in the Query Builder (shown below)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;IMG __jive_id="8998" alt="query01.jpg" class="jive-image-thumbnail jive-image" height="386" src="https://communities.sas.com/legacyfs/online/8998_query01.jpg" width="539" /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Select the "Add a New Computed Column" button (that looks like a calculator)&lt;/LI&gt;&lt;LI&gt;Select radio button next to "Advanced expression" and click Next&lt;/LI&gt;&lt;LI&gt;I manually type in the "Enter an expression:" pane: PCTL(25,&lt;/LI&gt;&lt;LI&gt;Now I need to get my raw data (&lt;EM&gt;n&lt;/EM&gt; = 46) into the PCTL function, separated by commas, so in the lower left pane, I double-click "Selected Columns" to see my variable length drop down here (see image below)&lt;/LI&gt;&lt;LI&gt;Then, I see this message in the pane to the right: "The maximum number of rows to process for retrieving &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt; distinct values&lt;/STRONG&gt;&lt;/SPAN&gt; may be limited"&lt;/LI&gt;&lt;LI&gt;When I click "Get Values," sure enough - it only pulls the distinct values from my variable Length, so when I then "Select Values" to insert them in the PCTL function, I don't have all my data, only the distinct values (and no, I did not select the "Select distinct rows only" box in the original Query Builder box"). In this case, I have &lt;EM&gt;n &lt;/EM&gt;= 40 distinct values, so those are the only values that get inserted into the PCTL function.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="8997" alt="Query.jpg" class="jive-image-thumbnail jive-image" height="331" src="https://communities.sas.com/legacyfs/online/8997_Query.jpg" width="637" /&gt;&lt;/P&gt;&lt;P&gt;I can't have this if I want to calculate something like a percentile - I need all of the data, not just distinct values! Why does it do this? Is there a way to change this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly (greatly) appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2015 17:23:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151338#M11855</guid>
      <dc:creator>MegJOH</dc:creator>
      <dc:date>2015-02-03T17:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder automatically selects only distinct values from raw data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151339#M11856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you're using it in a way not intended. That list is intend for WHERE or IF clauses so having a unique list makes sense and I doubt there's a way to change it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wouldn't recommend this method of calculating percentiles, it would be difficult to maintain, explain or follow for anyone else. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2015 17:38:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151339#M11856</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-03T17:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder automatically selects only distinct values from raw data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151340#M11857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems unreasonable to ask Query Builder to insert raw data as an argument in a function?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2015 17:41:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151340#M11857</guid>
      <dc:creator>MegJOH</dc:creator>
      <dc:date>2015-02-03T17:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder automatically selects only distinct values from raw data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151341#M11858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not intended and unconventional.&amp;nbsp; Generally, the purpose is to reference data sets, and variables not to include the raw data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to go this route add a step that selects all the values into a macro variable and use that in your function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2015 17:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151341#M11858</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-03T17:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder automatically selects only distinct values from raw data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151342#M11859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay. Thanks for letting me know. I'm not an EG user (I code in SAS), but am trying to use it for my intro stats class and it just seems intuitive to me that when you pull a variable over into the Query Builder that it should use that data as-is, or at least allow that option (especially when all functions, including those that require raw data, such as PCTL, are included in its menu in the Advanced Expression window), but it appears I don't understand the purpose of the Query Builder holistically. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm going to skip introducing them to Query Builder at this point and just wait until we use functions that don't require raw data (like finding &lt;EM&gt;p&lt;/EM&gt;-values based on a test statistic from a known distribution).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2015 17:50:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151342#M11859</guid>
      <dc:creator>MegJOH</dc:creator>
      <dc:date>2015-02-03T17:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder automatically selects only distinct values from raw data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151343#M11860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Query Builder essentially builds SQL code.&lt;/P&gt;&lt;P&gt;I'm sure you know, but some functions in SAS, such as PCTL, MEDIAN don't work in SAS SQL on a variable, they work across rows. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could transpose the data (Transpose Step) and then use the values that way though it seems like more work than writing some SAS code, i.e. proc univariate. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2015 17:55:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151343#M11860</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-03T17:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder automatically selects only distinct values from raw data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151344#M11861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That explains it. I didn't realize it was building SQL code per se. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2015 17:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-automatically-selects-only-distinct-values-from/m-p/151344#M11861</guid>
      <dc:creator>MegJOH</dc:creator>
      <dc:date>2015-02-03T17:59:33Z</dc:date>
    </item>
  </channel>
</rss>

