COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### SAS and dates

• Email
• Follow

I'm an Masters level student working on my thesis. I am trying to
figure out how to do this.

So basically I want to know how long has a person been living with a
disease on the day he/she took the survey. So I have the date that the
person has been diagnosed with a disease and the date the person took
the survey.
both dates are in datetime22.3 format and informat.

I know SAS keeps dates by the number of days since (or before) a
certain date.

So I figure to find out my question I would do:

LengthDisease=datesurveytaken-datediseasedx;

I figure that would give me days and i want this in years, so I would
do:

LengthDisease1=LengthDisease/365;

I get really odd results.

For my first case i get LengthDisease=34883200 and
LengthDisease1=68173.

I think my logic on getting this data makes sense. But clearly a 31
year old person would not have the disease for 68173 years.  So I am
unsure what i am doing wrong to get this data... I am hoping someone
on this message board can help.

 0

See related articles to this posting

On Mar 31, 1:11=A0pm, Tan <tan.p.p...@gmail.com> wrote:

> I know SAS keeps dates by the number of days since (or before) a
> certain date.

Datetimes are in seconds; not in days.

--
Paige Miller
paige\dot\miller \at\ kodak\dot\com

 0

You should use the DATEPART() and INTCK() functions. DATEPART()
extracts the date portion of a date/time field, while INTCK()
calculates the amount of time between two dates.

Example:  Daydiff =3D
INTCK('day',DATEPART(datesurveytaken),DATEPART(datediseasedx));

http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a0002=
12868.htm

Hope that helps....

Keith

On Mar 31, 1:11=A0pm, Tan <tan.p.p...@gmail.com> wrote:
> I'm an Masters level student working on my thesis. I am trying to
> figure out how to do this.
>
> So basically I want to know how long has a person been living with a
> disease on the day he/she took the survey. So I have the date that the
> person has been diagnosed with a disease and the date the person took
> the survey.
> both dates are in datetime22.3 format and informat.
>
> I know SAS keeps dates by the number of days since (or before) a
> certain date.
>
> So I figure to find out my question I would do:
>
> LengthDisease=3Ddatesurveytaken-datediseasedx;
>
> I figure that would give me days and i want this in years, so I would
> do:
>
> LengthDisease1=3DLengthDisease/365;
>
> I get really odd results.
>
> For my first case i get LengthDisease=3D34883200 and
> LengthDisease1=3D68173.
>
> I think my logic on getting this data makes sense. But clearly a 31
> year old person would not have the disease for 68173 years. =A0So I am
> unsure what i am doing wrong to get this data... I am hoping someone
> on this message board can help.


 0

2 Replies
393 Views

Similar Articles

12/7/2013 2:24:13 AM
[PageSpeed]

Similar Artilces:

FAQ Dates; Opera Dates.
<FAQENTRY> Warning concerning future FAQ updates (?). My ISP has changed its Web hosting arrangements. AFAICS, this has changed the allowed output bandwidth to a quarter of what it was, and has added a large chunk of superfluous logging data to be accommodated within the allocated space, which in my case was almost full. It may well, therefore, be necessary to reconsider how the FAQ handles date & time matters. In my (current) Opera 9.21, the Date Object is unreliable when its value exceeds 2^31 in magnitude and is near a Summer Time transition. It should be tested in other locations : different time zone, with or without different Summer Time Rules. IE & FF are OK. To test, scan new Date(Y, M, D) over a couple of weeks around the transitions for a few years around 2038. -- (c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6. Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.

Names and Dates
I have a combo box with several names, once a name is selected then it goes and gets a report of the name of the person that has been selected. I would like to put this and date selection on one form, the query won't run, it says that there is too many parameters. so select name then select dates that you would like to pull up and then put this into a report. Any help would be greatly apprectiated... as no idea where to turn on this one. Elaine Elainie wrote: > I have a combo box with several names, once a name is selected then it > goes and gets a report of the name of the person that has been > selected. > > I would like to put this and date selection on one form, the query > won't run, it says that there is too many parameters. > > so select name then select dates that you would like to pull up and > then put this into a report. > > Any help would be greatly apprectiated... as no idea where to turn on > this one. > > Elaine Assuming the combo is called ComboName and the dates are FromDate and ToDate and the date field in the table is DateFld, your code make look something like Docmd.OpenReport Me.ComboName

Help with dates
need help with a date problem. how can i get the first and last day of the previous month using the current date? (i.e. using the today function)? any help would be appreciated! db Hi, help eomday help weekday J�r�me

comparing dates?
Is there a better way to compare dates than breaking a date into day, month, year and comparing each part? I need to know if a date (say 10/03/2011) is before another date in the same format. Direct comparison doesn't work. Thanks Mike Michael Joel wrote: > Is there a better way to compare dates than breaking a date into day, > month, year and comparing each part? > I need to know if a date (say 10/03/2011) is before another date in > the same format. Direct comparison doesn't work. strtotime, but mind the layout of your date. For me the above would be tenth of march, for others it may be october 3rd. <?php echo strtotime("10/03/2011"), "\n"; ?> That should be easy enough to make comparisons http://php.net/manual/en/function.strtotime.php houghi -- How do you ask a man to be the last man to die in Iraq? How do you ask a man to be the last man to die for a mistake? On 10/2/2011 9:00 AM, Michael Joel wrote: > Is there a better way to compare dates than breaking a date into day, > month, year and comparing each part? > I need to know if a date (say 10/03/2011) is before another date in > the same format. Direct

Feedparser and dates
I'm using FeedParser.org to import feeds into our MySQL database. Our problem is that we haven't found a solution to translate the date of a post item into GMT. Any ideas? Thanks, Jacob "friis" wrote: > I'm using FeedParser.org to import feeds into our MySQL database. > Our problem is that we haven't found a solution to translate the date > of a post item into GMT. from what I can tell, feedparser returns a 9-item UTC time tuple (which is the same thing as GMT, at least for all practical purposes). if it's a standard timestamp you want, you can use

dates(help!)
i need to take dates from acceess ( inputs for matlab's matrix are dates from tables of access ). but i don't know how to do this. for example, i have to do a matrix, in matlab, with 4 elements (a 2x2 matrix of course) and this 4 numbers are the numbers in an access table called 'cables dates' ( the dates are written into access tables) . please hold me.. luca di russo wrote: > > > i need to take dates from acceess ( inputs for matlab's > matrix are dates from tables of access > ). but i don't know how to do this. for example, i have > to > do a matrix, in matlab, with 4 elements (a 2x2 matrix > of > course) and this 4 numbers are the numbers in an access > table called 'cables dates' ( the dates are written into > access tables) . please hold me.. It was very difficult to uderstand your problem, please use in future a better description and use complete name of other software, i.e. Microsoft Access instead of access. And, please, use the search engine in this forum too. For your problem you shoud use the database toolbox. <http://www.mathworks.com/products/database/> HTH peppe

Dates #2
would get yyyy-mm-dd, as per ISO 8601. Unless you control settings on all applicable machines, I suggest building your date string from a CDate CD by using Year(CD) Month(CD) Day(CD) and elementary operations. A little initial work ensures against much trouble-handling later. See my vb-dates.htm ff. via sig. -- (c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6. Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm Dates - miscdate.htm moredate.htm... as a string and a four-digit year, CDate(string) should never get it wrong. -- (c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6. Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc. "Martin Trump" <martin@wmeadow.demon.co.uk> wrote in message news:79MXfPBebkAHFwCs@wmeadow.demon.co.uk... > In message <VPWdnQDwkY-WeZzanZ2dnUVZ_jydnZ2d@comcast.com>

between dates
Why am I not getting any dates back with the code below? There are serveral dates with B - that I should be getting back Where contid CONTAINS 'B -' and cndtlet between '01SEP1996'd and '01JAN2005'd; run; In the log: There were 0 observations read from the data set DB.DPROPOSL. WHERE contid contains 'B -' and (cndtlet>='01SEP1996'D and cndtlet<='01JAN2005'D); thanks in advance! Greg Greg, The problem may be with your CONTID field. Also, are you sure that your date field is numeric and not character? What happens when you alter the syntax to Where contid like 'B%' and cndtlet between '01SEP1996'd and '01JAN2005'd; run; Venky Chakravarthy On Thu, 20 Oct 2005 10:14:49 -0700, Greg Curson <gscsrc@HOTMAIL.COM> wrote: >Why am I not getting any dates back with the code below? > >There are serveral dates with B - that I should be getting back > >Where contid CONTAINS 'B -' and > cndtlet between '01SEP1996'd and '01JAN2005'd; >run; > >In the log: >There were 0 observations read from the data set DB.DPROPOSL. >

metric dates
Filamaker 5.5 / xp pro using a text field I use metric date in it: 2005_02_25 and I can add the letter c in the field to indicate when I have Circa dates without interferring when I want to sort them in chronological order. My problem is that thousand of records have been imported in the database with the mm/dd/yyyy format. In addition numbers 00 have been put when teither the date or the month is unknown. In metric I would only put i.e 2005 02 if the day is unknown but they have used 02/00/2005.How can I change those date in a metric format? I would need to convert those zeros by nothing. Is there a script allowing me to do this? Please help. In article <xLRTd.59262\$6U2.1382294@weber.videotron.net>, "Simon Dupuy" <sammfm@videotron.ca> wrote: > Filamaker 5.5 / xp pro > using a text field I use metric date in it: 2005_02_25 and I can add the > letter c in the field to indicate when I have Circa dates without > interferring when I want to sort them in chronological order. My problem is > that thousand of records have been imported in the database with the > mm/dd/yyyy format. In addition numbers 00 have been put when teither

~~~~~~~~~~~~~~ CONCERT DATES ~~~~~~~~~~~~~~
.. ~~~***~~~ ================================================== ================================================== ENTER HERE: >>> http://web-sweb.com/2/concert-dates <<<... rock concert dates 1977 elvis presley concert dates 1997 tour of life concert dates 2004 bob dylan concert dates 2007 cockburn concert dates 2007 concert dates for michael stanley 2007 concert tour dates 2007 korn concert dates 2007 rap r b concert dates 2007 summer of love concert dates 2007 tool concert tour dates 2007 trans siberian orchestra concert dates 2007-2008 james taylor concert dates 2008 concert dates for paramour 2008 concert dates sonu nigam 2008 trans siberian orchestra concert dates 2009 devo concert dates 2009 elton john concert dates 2009 foreigner concert dates 2009 jimmy