<?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: Hard time getting results while creating a variable of  Age in Months in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Hard-time-getting-results-while-creating-a-variable-of-Age-in/m-p/337941#M1991</link>
    <description>&lt;P&gt;Please look at this code and see if it matches how you used intck and whether the ages are correct for your purpose.&lt;/P&gt;
&lt;PRE&gt;data example;
   dob= '15JAN2015'd;
   do sampledate= '01FEB2015'd, '14FEB2015'd, '15FEB2015'd,'16FEB2015'd, 
                  '01JAN2016'd, '14JAN2016'd, '15JAN2016'd,'16JAN2016'd;
      agemonths = intck('Month', dob,sampledate);
      put dob= date9. sampledate= date9. agemonths=;
      output;
   end;
   format dob sampledate date9.;
run;&lt;/PRE&gt;
&lt;P&gt;or did yours look more like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   dob= '15JAN2015'd;
   do sampledate= '01FEB2015'd, '14FEB2015'd, '15FEB2015'd,'16FEB2015'd, 
                  '01JAN2016'd, '14JAN2016'd, '15JAN2016'd,'16JAN2016'd;
      agemonths = intck('Month', dob,sampledate,'continuous');
      put dob= date9. sampledate= date9. agemonths=;
      output;
   end;
   format dob sampledate date9.;
run;&lt;/PRE&gt;
&lt;P&gt;BTW, you need to investigate how to use arrays.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Mar 2017 18:08:46 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-03-03T18:08:46Z</dc:date>
    <item>
      <title>Hard time getting results while creating a variable of  Age in Months</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Hard-time-getting-results-while-creating-a-variable-of-Age-in/m-p/337858#M1989</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I am trying to create age in months variable. I tried monthage=intnx('Month', DOB, sampledate) without 12 but I was getting numerical values in the hundred thousands (100,000s). Thus, I tried putting monthage= intnx('Month', DOB, sampledate, 12) because there are 12 months in a year. However, in the out put I got blanks, no errors for either runs.&amp;nbsp;Please see my code&amp;nbsp;below.&lt;/P&gt;&lt;PRE&gt;libname mydata "/folders/myshortcuts/myfolder";
run;

Data mydata.temp; 
set mydata.blkids2014;
/*Creating age at sampledates variables*/ 
age1=yrdif(DOB, sampledate,'ACT/ACT');
 age2=yrdif(DOB, sampledate2,'ACT/ACT');
 age3=yrdif(DOB, sampledate3,'ACT/ACT');
 age4=yrdif(DOB, sampledate4,'ACT/ACT');
 age5=yrdif(DOB, sampledate5,'ACT/ACT');
 age6 =yrdif(DOB, sampledate6,'ACT/ACT');
 age7=yrdif(DOB, sampledate7,'ACT/ACT');
 age8=yrdif(DOB, sampledate8,'ACT/ACT');
 age9=yrdif(DOB, sampledate9,'ACT/ACT');
 age10=yrdif(DOB, sampledate10,'ACT/ACT');
 age11=yrdif(DOB, sampledate11,'ACT/ACT');
 age12=yrdif(DOB, sampledate12,'ACT/ACT');
 age13=yrdif(DOB, sampledate13,'ACT/ACT');
 age14=yrdif(DOB, sampledate14,'ACT/ACT');
 age15=yrdif(DOB, sampledate15,'ACT/ACT');
 age16=yrdif(DOB, sampledate16,'ACT/ACT');
/*Creating age in months at sampledates variables*/
monthage1=intnx('Month', DOB, sampledate,12); 
monthage2=intnx('Month', DOB, sampledate2,12);
monthage3=intnx('Month', DOB, sampledate3,12);
monthage4=intnx('Month', DOB, sampledate4,12);
monthage5=intnx('Month', DOB, sampledate5,12);
monthage6=intnx('Month', DOB, sampledate6,12);
monthage7=intnx('Month', DOB, sampledate7,12);
monthage8=intnx('Month', DOB, sampledate8,12);
monthage9=intnx('Month', DOB, sampledate9,12);
monthage10=intnx('Month', DOB, sampledate10,12);
monthage11=intnx('Month', DOB, sampledate11,12);
monthage12=intnx('Month', DOB, sampledate12,12);
monthage13=intnx('Month', DOB, sampledate13,12);
monthage14=intnx('Month', DOB, sampledate14,12);
monthage15=intnx('Month', DOB, sampledate15,12);
monthage16=intnx('Month', DOB, sampledate16,12);
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Does anyone have any suggestions on how I can get month age variables (like 73 months, 2 months)?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LMP&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 15:18:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Hard-time-getting-results-while-creating-a-variable-of-Age-in/m-p/337858#M1989</guid>
      <dc:creator>LMP</dc:creator>
      <dc:date>2017-03-03T15:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Hard time getting results while creating a variable of  Age in Months</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Hard-time-getting-results-while-creating-a-variable-of-Age-in/m-p/337864#M1990</link>
      <description>&lt;P&gt;I tried intck instead and it worked!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 15:28:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Hard-time-getting-results-while-creating-a-variable-of-Age-in/m-p/337864#M1990</guid>
      <dc:creator>LMP</dc:creator>
      <dc:date>2017-03-03T15:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: Hard time getting results while creating a variable of  Age in Months</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Hard-time-getting-results-while-creating-a-variable-of-Age-in/m-p/337941#M1991</link>
      <description>&lt;P&gt;Please look at this code and see if it matches how you used intck and whether the ages are correct for your purpose.&lt;/P&gt;
&lt;PRE&gt;data example;
   dob= '15JAN2015'd;
   do sampledate= '01FEB2015'd, '14FEB2015'd, '15FEB2015'd,'16FEB2015'd, 
                  '01JAN2016'd, '14JAN2016'd, '15JAN2016'd,'16JAN2016'd;
      agemonths = intck('Month', dob,sampledate);
      put dob= date9. sampledate= date9. agemonths=;
      output;
   end;
   format dob sampledate date9.;
run;&lt;/PRE&gt;
&lt;P&gt;or did yours look more like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   dob= '15JAN2015'd;
   do sampledate= '01FEB2015'd, '14FEB2015'd, '15FEB2015'd,'16FEB2015'd, 
                  '01JAN2016'd, '14JAN2016'd, '15JAN2016'd,'16JAN2016'd;
      agemonths = intck('Month', dob,sampledate,'continuous');
      put dob= date9. sampledate= date9. agemonths=;
      output;
   end;
   format dob sampledate date9.;
run;&lt;/PRE&gt;
&lt;P&gt;BTW, you need to investigate how to use arrays.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 18:08:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Hard-time-getting-results-while-creating-a-variable-of-Age-in/m-p/337941#M1991</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-03T18:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Hard time getting results while creating a variable of  Age in Months</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Hard-time-getting-results-while-creating-a-variable-of-Age-in/m-p/338900#M2025</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Ballardw,&lt;/P&gt;&lt;P&gt;&amp;nbsp; I didn't put specific dates because there were a variety of dates. I phrased the statement as follows: monthage=intck('Month', DOB, sampledate);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps&amp;nbsp;and/ or answers your question!&amp;nbsp; Thanks for the tip about arrays! I have tried&amp;nbsp;it before&amp;nbsp;but at the time other variables&amp;nbsp;were deleted or no longer appeared.&amp;nbsp;Basically,&amp;nbsp;I&amp;nbsp;am still working&amp;nbsp;on getting&amp;nbsp;arrays to work&amp;nbsp;right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the Best,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LMP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 17:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Hard-time-getting-results-while-creating-a-variable-of-Age-in/m-p/338900#M2025</guid>
      <dc:creator>LMP</dc:creator>
      <dc:date>2017-03-07T17:20:41Z</dc:date>
    </item>
  </channel>
</rss>

