<?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 Best way to assess the age transitions within a subject during the study period in a longitudinal da in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Best-way-to-assess-the-age-transitions-within-a-subject-during/m-p/492438#M129402</link>
    <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a longitudinal data set and I am interested to know how many children&amp;nbsp;(&amp;lt;18 years of age) transition to adulthood (18 years and older) during the study period. Furthermore, I would like to create a binary variable that denotes if a child&amp;nbsp; transitioned to adulthood&amp;nbsp; and use that variable for further analyses. Please see the set up of data in the excerpt below. Any suggestions to easily create the transition binary variable will be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;I tried:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;data age_first;&lt;BR /&gt;set age_tran;&lt;BR /&gt;if first.studyid;&lt;/P&gt;&lt;P&gt;by studyid;&lt;BR /&gt;if age &amp;lt; 18 then Age_first = 1;&lt;BR /&gt;else age_first = 0;&lt;BR /&gt;keep studyid age age_first;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data age_last;&lt;BR /&gt;set age_tran;&lt;BR /&gt;if last.studyid;&lt;/P&gt;&lt;P&gt;by studyid;&lt;BR /&gt;if age &amp;gt;= 18 then Age_last = 1;&lt;BR /&gt;else Age_last = 0;&lt;BR /&gt;keep studyid age age_last;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data age_trans;&lt;BR /&gt;merge age_first (in=a) age_last (in=b);&lt;BR /&gt;by studyid;&lt;BR /&gt;Add_age = age_first + age_last;&lt;BR /&gt;if add_age &amp;gt;1 then age_trans = 1;&lt;BR /&gt;if add_age &amp;lt;= 1 then age_trans = 0;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This worked but felt like it was too long a process and I am wondering if there is an efficient way to code than what I followed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your time.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Sep 2018 19:10:57 GMT</pubDate>
    <dc:creator>jomag</dc:creator>
    <dc:date>2018-09-04T19:10:57Z</dc:date>
    <item>
      <title>Best way to assess the age transitions within a subject during the study period in a longitudinal da</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-way-to-assess-the-age-transitions-within-a-subject-during/m-p/492438#M129402</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a longitudinal data set and I am interested to know how many children&amp;nbsp;(&amp;lt;18 years of age) transition to adulthood (18 years and older) during the study period. Furthermore, I would like to create a binary variable that denotes if a child&amp;nbsp; transitioned to adulthood&amp;nbsp; and use that variable for further analyses. Please see the set up of data in the excerpt below. Any suggestions to easily create the transition binary variable will be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;I tried:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;data age_first;&lt;BR /&gt;set age_tran;&lt;BR /&gt;if first.studyid;&lt;/P&gt;&lt;P&gt;by studyid;&lt;BR /&gt;if age &amp;lt; 18 then Age_first = 1;&lt;BR /&gt;else age_first = 0;&lt;BR /&gt;keep studyid age age_first;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data age_last;&lt;BR /&gt;set age_tran;&lt;BR /&gt;if last.studyid;&lt;/P&gt;&lt;P&gt;by studyid;&lt;BR /&gt;if age &amp;gt;= 18 then Age_last = 1;&lt;BR /&gt;else Age_last = 0;&lt;BR /&gt;keep studyid age age_last;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data age_trans;&lt;BR /&gt;merge age_first (in=a) age_last (in=b);&lt;BR /&gt;by studyid;&lt;BR /&gt;Add_age = age_first + age_last;&lt;BR /&gt;if add_age &amp;gt;1 then age_trans = 1;&lt;BR /&gt;if add_age &amp;lt;= 1 then age_trans = 0;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This worked but felt like it was too long a process and I am wondering if there is an efficient way to code than what I followed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your time.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 19:10:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-way-to-assess-the-age-transitions-within-a-subject-during/m-p/492438#M129402</guid>
      <dc:creator>jomag</dc:creator>
      <dc:date>2018-09-04T19:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to assess the age transitions within a subject during the study period in a longitudina</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-way-to-assess-the-age-transitions-within-a-subject-during/m-p/492446#M129406</link>
      <description>&lt;P&gt;will this help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data age_tran;
input StudyID	Age;
cards;
1	14
1	15
1	17
1	18
1	19
1	19
1	19
1	19
1	19
2	23
2	23
2	26
2	26
2	26
3	18
3	18
3	19
3	19
;

data age_trans;
set age_tran;
by studyid;
retain Age_first;
if first.studyid or  last.studyid ;
if first.studyid then Age_first=age &amp;lt; 18;
else if  last.studyid then Age_last=age &amp;gt;= 18;
if last.studyid ;
Add_age = age_first + age_last;
age_trans=add_age &amp;gt;1;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Sep 2018 19:26:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-way-to-assess-the-age-transitions-within-a-subject-during/m-p/492446#M129406</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-04T19:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to assess the age transitions within a subject during the study period in a longitudina</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-way-to-assess-the-age-transitions-within-a-subject-during/m-p/492451#M129409</link>
      <description>Yes, it does! Thank you, Novinosrin!</description>
      <pubDate>Tue, 04 Sep 2018 19:29:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-way-to-assess-the-age-transitions-within-a-subject-during/m-p/492451#M129409</guid>
      <dc:creator>jomag</dc:creator>
      <dc:date>2018-09-04T19:29:24Z</dc:date>
    </item>
  </channel>
</rss>

