<?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 What does the x1, x2, and x3 do? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/What-does-the-x1-x2-and-x3-do/m-p/891335#M44175</link>
    <description>&lt;P&gt;I'm new to SAS.&lt;/P&gt;&lt;P&gt;I have the following code but have no idea what the x1, x2, and x3 do in the second univariate.&lt;/P&gt;&lt;P&gt;They later get dropped.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/****************************************************************&lt;BR /&gt;* basic hour counts, beginning and ending ob times&lt;BR /&gt;****************************************************************/&lt;BR /&gt;proc univariate data=indat noprint;&lt;BR /&gt;by year mo gp hr;&lt;BR /&gt;var observationtime;&lt;BR /&gt;output out = sample&lt;BR /&gt;n = samplesizeqty&lt;BR /&gt;min = begindate&lt;BR /&gt;max = enddate;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/****************************************************************&lt;BR /&gt;* yearly month counts, beginning and ending ob times&lt;BR /&gt;****************************************************************/&lt;/P&gt;&lt;P&gt;proc univariate data=sample noprint;&lt;BR /&gt;by year mo;&lt;BR /&gt;var samplesizeqty begindate enddate;&lt;BR /&gt;output out = sample2&lt;BR /&gt;sum = samplesizeqty&lt;BR /&gt;min = x1 begindate&lt;BR /&gt;max = x2 x3 enddate;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sample2;&lt;BR /&gt;set sample2;&lt;BR /&gt;by year mo;&lt;BR /&gt;gp = 1;&lt;BR /&gt;hr = 24;&lt;BR /&gt;drop x1-x3;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=sample2;&lt;BR /&gt;by year mo gp hr;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sample;&lt;BR /&gt;merge sample sample2;&lt;BR /&gt;by year mo gp hr;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Aug 2023 15:15:14 GMT</pubDate>
    <dc:creator>Bob9</dc:creator>
    <dc:date>2023-08-28T15:15:14Z</dc:date>
    <item>
      <title>What does the x1, x2, and x3 do?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/What-does-the-x1-x2-and-x3-do/m-p/891335#M44175</link>
      <description>&lt;P&gt;I'm new to SAS.&lt;/P&gt;&lt;P&gt;I have the following code but have no idea what the x1, x2, and x3 do in the second univariate.&lt;/P&gt;&lt;P&gt;They later get dropped.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/****************************************************************&lt;BR /&gt;* basic hour counts, beginning and ending ob times&lt;BR /&gt;****************************************************************/&lt;BR /&gt;proc univariate data=indat noprint;&lt;BR /&gt;by year mo gp hr;&lt;BR /&gt;var observationtime;&lt;BR /&gt;output out = sample&lt;BR /&gt;n = samplesizeqty&lt;BR /&gt;min = begindate&lt;BR /&gt;max = enddate;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/****************************************************************&lt;BR /&gt;* yearly month counts, beginning and ending ob times&lt;BR /&gt;****************************************************************/&lt;/P&gt;&lt;P&gt;proc univariate data=sample noprint;&lt;BR /&gt;by year mo;&lt;BR /&gt;var samplesizeqty begindate enddate;&lt;BR /&gt;output out = sample2&lt;BR /&gt;sum = samplesizeqty&lt;BR /&gt;min = x1 begindate&lt;BR /&gt;max = x2 x3 enddate;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sample2;&lt;BR /&gt;set sample2;&lt;BR /&gt;by year mo;&lt;BR /&gt;gp = 1;&lt;BR /&gt;hr = 24;&lt;BR /&gt;drop x1-x3;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=sample2;&lt;BR /&gt;by year mo gp hr;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sample;&lt;BR /&gt;merge sample sample2;&lt;BR /&gt;by year mo gp hr;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 15:15:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/What-does-the-x1-x2-and-x3-do/m-p/891335#M44175</guid>
      <dc:creator>Bob9</dc:creator>
      <dc:date>2023-08-28T15:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: What does the x1, x2, and x3 do?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/What-does-the-x1-x2-and-x3-do/m-p/891337#M44176</link>
      <description>&lt;P&gt;Not sure they are doing anything.&amp;nbsp; &amp;nbsp;They are names you are using for statistics you are calculating.&lt;/P&gt;
&lt;P&gt;In these two statements:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var samplesizeqty begindate enddate;
output
  out = sample2
  sum = samplesizeqty
  min = x1 begindate
  max = x2 x3 enddate
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You are saying that X1 will be the minimum value of samplesizeqty .&lt;/P&gt;
&lt;P&gt;X2 will be the maximum value of&amp;nbsp;samplesizeqty.&lt;/P&gt;
&lt;P&gt;X3 will be the maximum value of&amp;nbsp;begindate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume they are there because the programmer could not figure out how to set the names to use for the minumum value of begindate and the maximum value enddate without listing names for the variables that come before them in the VAR statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know how to do it with PROC SUMMARY (aka PROC MEANS), but I am not sure if the syntax is the same for PROC UNIVARIATE, you could try.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But since you are not calculating any statistics that need PROC UNIVARIATE you can just use PROC MEANS (aka PROC SUMMARY) instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=sample;
  by year mo;
  var samplesizeqty begindate enddate;
  output
    out = sample2
    sum(samplesizeqty) = samplesizeqty
    min(begindate) = begindate
    max(enddate) = enddate
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 15:27:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/What-does-the-x1-x2-and-x3-do/m-p/891337#M44176</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-08-28T15:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: What does the x1, x2, and x3 do?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/What-does-the-x1-x2-and-x3-do/m-p/891454#M44182</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp; What you said makes sense to me.&amp;nbsp; I really appreciate the help.&amp;nbsp; There are several more of these and now I believe that I understand and that feels good.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 10:53:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/What-does-the-x1-x2-and-x3-do/m-p/891454#M44182</guid>
      <dc:creator>Bob9</dc:creator>
      <dc:date>2023-08-29T10:53:27Z</dc:date>
    </item>
  </channel>
</rss>

