<?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 coding date to sequence and regression coefficients output in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/coding-date-to-sequence-and-regression-coefficients-output/m-p/255619#M48849</link>
    <description>&lt;P&gt;I have ID, amount, date in my data sets, and each ID has a number of amount &amp;amp; date.&lt;/P&gt;
&lt;P&gt;Now I want to have a sequence variable, that for each ID, the first date has sequence value 1, the second date has sequence value 2, etc. For those with has only 1 date, delete.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can anyone tell me how to do this? I sort by ID and date, and use first.ID and last.ID to loop?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;another question is, after I have the sequence variable, I want to use regression (DV=amount, IV=sequence) to see the trend of the amount, positive or negative. I want to have a new data set with only ID and Beta (coefficients).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC REG DATA=with_sequence;
   BY ID ;
   MODEL amount= sequence ;
   output out=b;
RUN; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is this the right way to do&amp;nbsp; it?&lt;/P&gt;</description>
    <pubDate>Wed, 09 Mar 2016 19:00:51 GMT</pubDate>
    <dc:creator>fengyuwuzu</dc:creator>
    <dc:date>2016-03-09T19:00:51Z</dc:date>
    <item>
      <title>coding date to sequence and regression coefficients output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-date-to-sequence-and-regression-coefficients-output/m-p/255619#M48849</link>
      <description>&lt;P&gt;I have ID, amount, date in my data sets, and each ID has a number of amount &amp;amp; date.&lt;/P&gt;
&lt;P&gt;Now I want to have a sequence variable, that for each ID, the first date has sequence value 1, the second date has sequence value 2, etc. For those with has only 1 date, delete.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can anyone tell me how to do this? I sort by ID and date, and use first.ID and last.ID to loop?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;another question is, after I have the sequence variable, I want to use regression (DV=amount, IV=sequence) to see the trend of the amount, positive or negative. I want to have a new data set with only ID and Beta (coefficients).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC REG DATA=with_sequence;
   BY ID ;
   MODEL amount= sequence ;
   output out=b;
RUN; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is this the right way to do&amp;nbsp; it?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2016 19:00:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-date-to-sequence-and-regression-coefficients-output/m-p/255619#M48849</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-03-09T19:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: coding date to sequence and regression coefficients output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-date-to-sequence-and-regression-coefficients-output/m-p/255621#M48851</link>
      <description>&lt;P&gt;Is this what you're trying to do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.ats.ucla.edu/stat/sas/faq/enumerate.htm" target="_blank"&gt;http://www.ats.ucla.edu/stat/sas/faq/enumerate.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2016 19:06:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-date-to-sequence-and-regression-coefficients-output/m-p/255621#M48851</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-09T19:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: coding date to sequence and regression coefficients output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-date-to-sequence-and-regression-coefficients-output/m-p/255622#M48852</link>
      <description>&lt;P&gt;Thank you! The first problem solved. I can use this example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data two;
  input class gender score;
  cards;
  1 1 48
  1 1 45
  2 2 50
  1 2 42
  2 1 41
  2 2 51
  2 1 52
  1 1 43
  1 2 52
  ;
run;

proc sort data = two;
  by class gender;
run;

data two1;
  set two;
  count + 1;
  by class gender;
  if first.gender then count = 1;
run;

proc print data = two1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Mar 2016 19:11:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-date-to-sequence-and-regression-coefficients-output/m-p/255622#M48852</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-03-09T19:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: coding date to sequence and regression coefficients output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-date-to-sequence-and-regression-coefficients-output/m-p/255635#M48857</link>
      <description>&lt;P&gt;For your second question look at the output tables, but you may also be interested in teh ODS output tables. I think the one you're after is called ParameterEstimates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods table parameterEstimates=want;
Proc reg......;
*rest of code;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Mar 2016 20:10:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-date-to-sequence-and-regression-coefficients-output/m-p/255635#M48857</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-09T20:10:36Z</dc:date>
    </item>
  </channel>
</rss>

