Date: Tue, 10 Jul 2007 09:07:15 -0500
Reply-To: Kevin Morgan <kmorgan@GRAINSCANADA.GC.CA>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Kevin Morgan <kmorgan@GRAINSCANADA.GC.CA>
Subject: Re: Macro Quoting Question
Content-Type: text/plain; charset="us-ascii"
Hi Howard:
More steps: that raises the next question in pursuit of making things
easier. Why are you handling 27 data sets, instead of one big data set
with
a 27-level stratifying variable?
This is part of a random sampling program, and outputting a list of
results that a client wants. Essentially they want an entire list of
activity each week and called-sample flag (I used proc survey select and
then simply remerged the selected samples back to the list) In theory I
could have used the larger list however the client may want to make
changes to the sampling regime, and the intensity at each of the
locations. In effect I could see having to add additional locations
(i.e. more data sets) or removing some locations and I thought that
breaking each location into it's own data set would allow me the most
amount of control possible. It's a verbose way to write a program I
realize however I have only SAS for a few months now and I'm sure six
months down the road I would do things differently, or then again maybe
not.
Thank you for also going through how the macro is working with the data
and the SQL steps. I am still a linear type thinker when it comes to SAS
programming.
Regards,
Kevin
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Howard Schreier <hs AT dc-sug DOT org>
Sent: Monday, July 09, 2007 3:54 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Macro Quoting Question
On Sun, 8 Jul 2007 21:14:37 -0500, Kevin Morgan
<kmorgan@GRAINSCANADA.GC.CA>
wrote:
>Howard:
>
>This is how I envisioned my macro working in the first place. Thank you
>for this piece of beautiful code. I can follow along with it quite well
>but it is well and truly beyond anything I could have come up with on
my
>own. Embedding a proc sql within a data step and calling the macro
>within the proc sql is very impressive.
I would not characterize things this way. I think you are influenced by
the
order in which you see things in the code. The process sequence can be
different.
The DATA step is working with character strings and throwing them on the
"stack" for processing. It does not know or care that they happen to
form
valid and useful SQL code.
The DATA step calls the macro. By the time SQL runs, the DATA step and
the
macro are long gone.
>I will have a few more
>occasions where I will be able to use this macro as part of the
sampling
>process that I am writing.
>
>I had orginally intended to use the verbose method of
>
>Proc sql select count(*) as count :into S_prairie from prairie; quit;
>
>But I have two more steps in the sampling process where I need to keep
>the enduser appraiesed of any samples that are missing, or have been
>called by other programs so another count will be required and the code
>you have provided will be most useful for those programs as well.
More steps: that raises the next question in pursuit of making things
easier. Why are you handling 27 data sets, instead of one big data set
with
a 27-level stratifying variable?
>snip