Date: Thu, 12 May 2005 10:54:18 -0500
Reply-To: Duck-Hye Yang <dyang@CHAPINHALL.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Duck-Hye Yang <dyang@CHAPINHALL.ORG>
Subject: Re: date as a callable macro variable
Content-Type: text/plain; charset=US-ASCII
Thanks for your comments!
I am starting to see dim light at the end of long tunnel ^^ As you
pointed out, my problem needs a breakthrough, which I had no idea of.
Please see inserts.
>>> "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM> 5/12/2005 6:22:00
Duck-Hye Yang wrote:
> I have a macro code (Getdates, below) for calculating distance among
> some locations.
> My problem is that I have to run this code for each date during the
> duration from 1/1/99 to 6/30/2004.
I have a strong feeling maybe not. What kind of computation or
algorithm do you have to perform for each day ?
----THE DISTANCE MACRO WAS YOURS: CALCULATION OF DISTANCE BETWEEN A
PAIR OF ZIPS USING SPHERIEN DISTANCE FORMULA.
I HAVE USED IT MANY TIMES SINCE I DOWNLOADED IT.
I AM APPLYING IT TO A NEW PROBLEM: CALCULATING DISTANCE BETWEEN CRIME
SITE AND SCHOOL AND CALCULATING # INCIDENTS WITHIN 1 MILE OF SCHOOL.
%put %sysevalf ("30JUN2004"d - "01JAN1999"d);
If each macro invocation creates a table, do you really want to create
----THAT WAS THE ONLY ONE THAT I COULD THINK OF. WORSE THAN THAT, IN
FACT, I WOULD HAVE TO DO THIS 2,007 TIMES FOR EACH OF 35 SCHOOLS, WHICH
You can probably use arrays and/or by group processing; with maybe a
transpose or two thrown in. If you need rolling computations and have
licensed, look into Proc MACONTROL of CUSUM. I don't know the
procs well, but there is likely one in that package as well for
---THE FINAL DATA STRUCTURE REQUIRES TRANSPOSE: MULTIPLE RECORDS FOR A
SCHOOL WITH TOTAL # INCIDENT THAT OCCURRED ON EACH DAY WITHIN ONE MILE
OF SCHOOL. THE # OF RECORDS WOULD BE 35*2,007 WITH THREE VARIABLES,
SCHOOL, DATE, #INCIDENTS
---I AM MORE THAN WILLING TO CHECK WITH OTHER OPTIONS!!!! THANKS FOR
> I have a sas system data (datedata, below) that contains date (in
> date format).
> To make the code below working, should I convert date format to
> 01JAN1999 first?
> Duckhye Yang
You have the appearance of onset macro-itis. Typically, one does not
their macro arguments, especially if the parameter is a date value.
whens, hows and why nots are highly dependent on what the macro
does -- which you do not show.
You will need to convert if you want valid OUT= values ... presuming,
is a table name or a column name. If OUT= is neither, I would
using a parameter name other than OUT)
---- THANKS FOR YOUR ADVICE, ALTHOUGH I MAY NEED TIME TO UNDERSTAND
WHAT YOU MEANT.
AND YOU ARE RIGHT: 'OUT' WAS A TABLE NAME AS I INITIALLY PLANNED.
Richard A. DeVenezia -- Learn how to customize SAS Explorer