<?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: create a variable from a date in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/create-a-variable-from-a-date/m-p/668799#M23185</link>
    <description>&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jul 2020 13:02:40 GMT</pubDate>
    <dc:creator>Annie_Fréchette</dc:creator>
    <dc:date>2020-07-13T13:02:40Z</dc:date>
    <item>
      <title>create a variable from a date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-a-variable-from-a-date/m-p/668793#M23182</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I want to create a variable who goes frome 1 to 12 based on the date of a test (like first test of the year, second test of the year etc) Here is a little example of what I want it to look like:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annie_Fréchette_0-1594643534926.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47085i2B50E299EEE6A7F1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Annie_Fréchette_0-1594643534926.png" alt="Annie_Fréchette_0-1594643534926.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Anyone can teach me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Annie&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 12:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-a-variable-from-a-date/m-p/668793#M23182</guid>
      <dc:creator>Annie_Fréchette</dc:creator>
      <dc:date>2020-07-13T12:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: create a variable from a date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-a-variable-from-a-date/m-p/668794#M23183</link>
      <description>&lt;P&gt;please try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input cow$ irtest:ddmmyy10. scc;
cards;
daisy 10/7/2017 200
maggy 10/7/2017 120
lily 10/7/2017 98
daisy 11/8/2017 89
maggy 11/8/2017 120
lily 11/8/2017 98
;

proc sort data=have;
format irtest date9.;
by cow irtest;
run;

data want;
set have;
by cow irtest;
retain no_test;
if first.cow then no_test=1;
else no_test+1;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jul 2020 12:45:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-a-variable-from-a-date/m-p/668794#M23183</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2020-07-13T12:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: create a variable from a date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-a-variable-from-a-date/m-p/668795#M23184</link>
      <description>&lt;P&gt;Can be solved by sorting data by Cow and JR_Test and a datastep with first and retain to create no_test.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have_sorted;
  by Cow;

  length no_test 8;
  retain no_test;

  if first.Cow then no_test = 0;
  no_test = no_test + 1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The code is untested, because you haven't provided data in usable form.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 12:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-a-variable-from-a-date/m-p/668795#M23184</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-07-13T12:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: create a variable from a date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-a-variable-from-a-date/m-p/668799#M23185</link>
      <description>&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 13:02:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-a-variable-from-a-date/m-p/668799#M23185</guid>
      <dc:creator>Annie_Fréchette</dc:creator>
      <dc:date>2020-07-13T13:02:40Z</dc:date>
    </item>
  </channel>
</rss>

