Date: Wed, 28 Mar 2001 13:41:10 -0600 Jonathan Goldberg "SAS(r) Discussion" Jonathan Goldberg Reading and finding data cc: edwardsm@UOGUELPH.CA TEXT/PLAIN; charset=US-ASCII

Michelle:

I will start with two assumptions: 1)There is no missing data 2)If there is a sequence of four or more days above 12.8 degrees all those from the 3rd on will be picked.

Restructuring the data set into days and passing the resultant data set will do it. For example:

*-- first. produce a data set with one observation per day;

data days(keep = yr month day temp); array days (*) day1-day31;

set yourdata;

do i = 1 to dim(days) until(days(i) = .); day = i; temp = days(i); output; end; run;

*-- now, pass the resultant data set looking for days desired;

%let critical = 12.8; /*threshold temperature*/

data results(keep = yr month day temp);

set days;

if temp >= &critical then seq + 1; else seq = 0; if seq => 3 then output; /*if only the end of exactly 3 days */ /*desired change this condition to =*/

run;

Jonathan

-----Original Message Seperator----- From: Michelle Edwards <edwardsm@UOGUELPH.CA> Subject: Reading and finding data

Good day all!

I have a dataset set up as follows:

Yr month day1 day2 day3 ...... day31 1917 1 7.5 6.3 7.1 ....... 9.0 1917 2 ..................................... . . 1993 12 ........................................

days run from 1 to 31 to correspond with the days in the month and years run from 1917 through to 1993 - there is a line per month. The values are mean daily temperatures for the corresponding date.

One task that I need to accomplish - and I have no idea how to even start it - is to identify the mean temperature and date which corresponds to the last day of three consecutive days having a mean temperature of 12.8 or higher.

Any suggestions? Are there any tools or procedures other than the Data step that may be of help here?

Thanks, Michelle

Jonathan Goldberg Dept. of Psychiatry Washington University School of Medicine 40 N. Kingshighway, Suite One St. Louis, MO 63108 314-286-2212

Back to: Top of message | Previous page | Main SAS-L page