Date: Mon, 7 May 2001 14:54:13 -0400 "Bosch, Jules [PRI]" "SAS(r) Discussion" "Bosch, Jules [PRI]" Re: Hours of daylight by day To: "PBourdages@IAG.QC.CA" multipart/alternative;

Sunrise, Sunset, Sunrise, Sunset, Swiftly flow the day.

Couldn't resist.

Jules

-----Original Message----- From: Patrice Bourdages [SMTP:PBourdages@IAG.QC.CA] Sent: Monday, May 07, 2001 2:40 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Hours of daylight by day

You might want to try this... and adapt for your own need. It's working very well for my need. data;

retain data SunRise SunSet HoursOfDaylight;

input latitude longitud timezone;

array sun{0:1} SunSet SunRise;

pi = arcos(-1);

lambda = longitud / 15;

do date = intnx("month",today(),0) to intnx("month",today(),1)-1;

n = date-intnx("year",date,0)+1;

dst = mdy(4,7,year(date))-weekday(mdy(4,7,year(date))) LT date LE mdy(10,31,year(date))-weekday(mdy(10,31,year(date)));

do s = 0 to 1;

t = n+(18-12*s-lambda)/24;

delta =.39782*sin(l);

sun{s} = 3600 * (mod(24*((1-2*s)

* arcos((-.01454-sin(delta)*sin(phi))

/(cos(delta)*cos(phi)))

/(2*pi)+s)+12*(atan(.91746*tan(l))/pi

+(mod(floor(l*2/pi)+4,4)

in(1,2)))-.06571*t-6.622

- lambda + timezone + dst + 48,24));

end;

HoursOfDaylight = intck("second",SunRise,SunSet);

output;

end;

format date yymmdd10. SunRise SunSet time5. format HoursOfDaylight time5.;

keep date SunRise SunSet HoursOfDaylight;

** Coordonnates for Quebec city;

cards;

46.8521 -71.3015 -5

;

run;

title 'Québec';

proc calendar legend;

start date;

var SunRise SunSet HoursOfDaylight;

run;

Excuse the bad format. You just have to replace the coordinates in the cards section for you location's one and you should be all set to go..

Sincerely yours, \\\|/// \\ - - // ( o o ) +-----oOOo-(_)-oOOo------------+--------------------------------+ | Patrice Bourdages | | | SI Analyst | Tel : (418) 650-4600 x3216 | | Industrielle Alliance, | Fax : (418) 650-4825 | | Assurances auto & habitation | E-mail: pbourdages@iag.qc.ca | +--------------Oooo------------+--------------------------------+ oooO ( ) ( ) ) / \ ( (_/ \_)

-----Message d'origine----- De : Charlie Brown [mailto:project_monkey@HOTMAIL.COM] Envoyé : 7 mai, 2001 13:28 À : SAS-L@LISTSERV.UGA.EDU Objet : OT: Hours of daylight by day Sorry for the OT post: Where can I find the number of hours of daylight by day for geographical locations? Any Ideas? Thanks: Charlie