<?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: intck in years with serial data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/intck-in-years-with-serial-data/m-p/922005#M363095</link>
    <description>&lt;P&gt;I did notice first. variable was not in the output, now I understand why.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the information it is very much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Mar 2024 17:03:21 GMT</pubDate>
    <dc:creator>JJG</dc:creator>
    <dc:date>2024-03-27T17:03:21Z</dc:date>
    <item>
      <title>intck in years with serial data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intck-in-years-with-serial-data/m-p/921989#M363083</link>
      <description>&lt;PRE&gt;&lt;CODE class=""&gt;Hi everyone,&lt;BR /&gt;&lt;BR /&gt;I am trying to calculate number of years from baseline visit by subjects. Date format is mmddyy10.&lt;BR /&gt;When I try the code below, it does the job for the first visit date (baseline) but not for the &lt;BR /&gt;following visit dates (see results table at the end):&lt;BR /&gt;&lt;BR /&gt;proc sort data= have; 
by ID Test_Date; 
run; &lt;BR /&gt;
data want; 
set have; 
length Visit 8.; 
by ID Test_Date; 
retain first.Test_Date; 
 
if first.ID then do; 
    first.Test_Date = Test_Date; 
end;      
 
Visit = intck('year',first.Test_Date,Test_Date)+1; 
format first.Test_Date Test_Date mmddyy10.; 
 
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&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BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 15:46:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intck-in-years-with-serial-data/m-p/921989#M363083</guid>
      <dc:creator>JJG</dc:creator>
      <dc:date>2024-03-27T15:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: intck in years with serial data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intck-in-years-with-serial-data/m-p/921991#M363084</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data= have; 
by ID Test_Date; 
run; 

data want; 
set have; 
length Visit 8.; 
by ID Test_Date; 
retain first_Test_Date; 
 
if first.ID then do; 
    first_Test_Date = Test_Date; 
end;      
 
Visit = intck('year',first_Test_Date,Test_Date)+1; 
format first_Test_Date Test_Date mmddyy10.; 
 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can't quite use first. in that manner, instead create a new variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 15:50:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intck-in-years-with-serial-data/m-p/921991#M363084</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-03-27T15:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: intck in years with serial data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intck-in-years-with-serial-data/m-p/921994#M363087</link>
      <description>&lt;P&gt;Values of the variables FIRST&lt;STRONG&gt;.&lt;/STRONG&gt;Test_date (or Last.Test_date or any first / last variable) will only ever be 1 and 0. (the dot is important). The first and last also get reset at each read of the data so would be pretty useless in INTCK.&lt;/P&gt;
&lt;P&gt;You want to retain a variable First_test_date and use that in your calculation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also the automatic variables First. and Last. are not written to the output data set. Did you notice that?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 16:07:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intck-in-years-with-serial-data/m-p/921994#M363087</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-03-27T16:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: intck in years with serial data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intck-in-years-with-serial-data/m-p/922004#M363094</link>
      <description>&lt;P&gt;That worked perfectly!&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 16:59:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intck-in-years-with-serial-data/m-p/922004#M363094</guid>
      <dc:creator>JJG</dc:creator>
      <dc:date>2024-03-27T16:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: intck in years with serial data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intck-in-years-with-serial-data/m-p/922005#M363095</link>
      <description>&lt;P&gt;I did notice first. variable was not in the output, now I understand why.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the information it is very much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 17:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intck-in-years-with-serial-data/m-p/922005#M363095</guid>
      <dc:creator>JJG</dc:creator>
      <dc:date>2024-03-27T17:03:21Z</dc:date>
    </item>
  </channel>
</rss>

