[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: Indicating age years
From:       Joe Matise <snoopy369 () GMAIL ! COM>
Date:       2020-09-29 14:34:24
Message-ID: CAM+YpE8ZFJLsq++BC2S9bOVNo1=03OvKaanEhqoAS+ydbCKsXA () mail ! gmail ! com
[Download RAW message or body]

I will say that the way you're describing is extremely common (AGEUNIT and
AGENUM or whatever), and might be the best option for other data users if
you're producing a data use file, though I find it annoying.  If you're
just reporting, you should do whatever works best for you :)

Thanks,
Joe

On Tue, Sep 29, 2020 at 8:58 AM Stanford Mwasongwe <smwasongwe@gmail.com>
wrote:

> Thank you all for the suggested solutions. To Carl's suggestion, currently
> we've age unit as a variable in its own, if age<1 then ageunit is months
> and if gt 1 then ageunit years. I was trying to learn if there's a format
> option, to which Joe suggested of proc pic. Thanks again to everyone for
> always being helpful.
> *Stanford*
>
>
>
> On Tue, Sep 29, 2020 at 12:48 AM Joe Matise <snoopy369@gmail.com> wrote:
>
>> I don't entirely understand what you mean, but it sure sounds like
>> formatting to me.  What else would it be?  You're taking a number and
>> displaying it in a certain way.  That's formatting.
>>
>> It's certainly possible to display a numeric value in such a way; say:
>>
>> proc format;
>>   picture agef
>>   1-11 = '00 Months'
>>   12-1500 = '000 Years' (mult=0.083333333)
>>  ;
>> quit;
>>
>> data _null_;
>>   do x = 1,2,6,9,12,24,48,51,105,488,1048;
>>     put x= agef.;
>>   end;
>> run;
>>
>> That very simply takes as input a number of months and outputs age in
>> months/years.
>>
>> Now, if you don't have that, you need to get that; there're plenty of
>> tutorials for calculating exact age in SAS online.  Use one that gives you
>> months, or whatever kind of value you have you can adapt to the above.
>>
>> -Joe
>>
>> On Mon, Sep 28, 2020 at 10:07 PM Stanford Mwasongwe <smwasongwe@gmail.com>
>> wrote:
>>
>>> Hello everyone,
>>> Is it possible to indicate years after age as in 8 years or 10 months
>>> within the same variable? I am not sure what we will call that, it's not
>>> formatting.
>>>
>>> Thank you
>>> *Stanford*
>>>
>>>

[Attachment #3 (text/html)]

<div dir="ltr">I will say that the way you&#39;re describing is extremely common \
(AGEUNIT and AGENUM or whatever), and might be the best option for other data users \
if you&#39;re producing a data use file, though I find it annoying.   If you&#39;re \
just reporting, you should do whatever works best for you \
:)<div><br></div><div>Thanks,</div><div>Joe</div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 29, 2020 at 8:58 AM \
Stanford Mwasongwe &lt;<a \
href="mailto:smwasongwe@gmail.com">smwasongwe@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
class="gmail_default" style="font-family:verdana,sans-serif">Thank you all for the \
suggested solutions. To Carl&#39;s suggestion, currently we&#39;ve age unit as a \
variable in its own, if age&lt;1 then ageunit is months and if gt  1 then ageunit \
years. I was trying to learn if there&#39;s a format option, to which Joe suggested \
of proc pic. Thanks again to everyone for always being helpful.</div><div><div \
dir="ltr"><div dir="ltr"><div><span style="font-size:x-small"><font \
size="2"><font><span style="font-size:10pt"><font face="bookman old style, new york, \
times, serif" color="#444444"><b>Stanford</b></font></span></font></font></span></div><div><br></div></div></div></div><br></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 29, 2020 at 12:48 \
AM Joe Matise &lt;<a href="mailto:snoopy369@gmail.com" \
target="_blank">snoopy369@gmail.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr">I don&#39;t entirely understand \
what you mean, but it sure sounds like formatting to me.   What else would it be?   \
You&#39;re taking a number  and displaying it in a certain way.   That&#39;s \
formatting.<div><br></div><div>It&#39;s certainly possible to display a numeric value \
in such a way; say:</div><div><br></div><div>proc format;<br>   picture agef <br>   \
1-11 = &#39;00 Months&#39;<br>   12-1500 = &#39;000 Years&#39; (mult=0.083333333)<br> \
;<br>quit;<br><br>data _null_;<br>   do x = 1,2,6,9,12,24,48,51,105,488,1048;<br>     \
put x= agef.;<br>   end;<br>run;<br>        <br></div><div>That very simply takes as \
input a number  of months and outputs age in \
months/years.</div><div><br></div><div>Now, if you don&#39;t have that, you need to \
get that; there&#39;re plenty of tutorials for calculating exact age in SAS online.   \
Use one that gives you months, or whatever kind of value you have you can adapt to \
the above.</div><div><br></div><div>-Joe</div></div><br><div class="gmail_quote"><div \
dir="ltr" class="gmail_attr">On Mon, Sep 28, 2020 at 10:07 PM Stanford Mwasongwe \
&lt;<a href="mailto:smwasongwe@gmail.com" \
target="_blank">smwasongwe@gmail.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" \
style="font-family:verdana,sans-serif">Hello everyone,</div><div \
class="gmail_default" style="font-family:verdana,sans-serif">Is it possible to \
indicate years after age as in 8 years or 10 months within the same variable? I am \
not sure what we will call that, it&#39;s not formatting.</div><div \
class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div \
class="gmail_default" style="font-family:verdana,sans-serif">Thank you  \
</div><div><div dir="ltr"><div dir="ltr"><div><span style="font-size:x-small"><font \
size="2"><font><span style="font-size:10pt"><font face="bookman old style, new york, \
times, serif" color="#444444"><b>Stanford</b></font></span></font></font></span></div><div><br></div></div></div></div></div>
 </blockquote></div>
</blockquote></div>
</blockquote></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic