Re: Macro Variable w. Another Macro Variable in name #3 Does the following describe what you are now trying to do?
%let myarray=XX XY YY;
%do i=1 %to 3;
On Fri, 19 Jan 2007 08:14:41 -0600, OR Stats <stats112@GMAIL.COM> wrote:
>Hi Arthur and all,
>It's getting closer thankfully. The code below works. However, when I
>to make this macro variable (that has another ma...
Re: Macros that return values in specified macro variables #3 1540930 Hi Richard,
Another alternative with macros like you present, NOT containing any SAS code, only macro code, is to return the value of RC as the result of the macro call. Thus in your macro code at the end just specify:
&RC /* without semicolon */
and remove the RC argument from the parameter list;
and call your macro by:
%LET RC = %attrc (data=foo.bar, lib=libname, mem=memname);
Se a.o. http://listserv.uga.edu/cgi-bin/wa?A2=ind0310C&L=sas-l&P=R13877
Regards - Jim.
.. . . . . . . . . . . . . . . .
Jim Groeneveld, MSc.
Re: macros #3 From: On Behalf Of vani palla
> I am learning SAS.
> Could you please tell me why macros are so important in SAS
> than in any other language.
macros and their associated parameters: macro variables
allow one to write a reusable program
Macros can be as simple as a one-line function
which returns a value used within a SAS statement
or as powerful as several procedures.
Macros may be either of type:
* routine: perform a specific task
* sub-routine: perform a general task.
macros have these types of parameters
adjectives, which modify either the input or output
adverbs , which mod...
Basic Bootstrap Macro Hey guys,
Working to generate bootstrap estimates for standard errors from a simple
Found a macro on the web, modified it as follows:
**** Beg of Macro code ****;
input y x;
%DO i = 1 %to 100;
choice = RANUNI(&i);
set new POINT = choice NOBS = 10;
IF i > n THEN STOP;
PROC REG DATA = analysis NOPRINT outest= outests;
(KEEP= intercept x );
MODEL y = x;
PROC APPEND BASE = parms DATA = outests;
Re: Macro Question? #3 Michael D Ross <michael.ross@ASTRAZENECA.COM> wants a function to
resolve macro variables inside single quotes.
The language is designed to work with double quotes so, without
comment about the design of his macro, it becomes:
%do i=1 %to &numvars;
%let subset=%str(where xxx eq "&&value&i"); *<<<;
However, a macro could serve as the desired function and perhaps
has use where the code being generated is going to another system
where single quotes are essential.
Re: %squeeze macro #3 Hi Chang-
Aside from the questionable macro programming, what concerns me about
%squeeze is the implication that it's a good idea to store numbers in their
smallest possible width. Users of the data unaware of the non-standard
storage may use the variables in operations that need greater precision. If
numeric data needs to be compressed then COMPRESS=BINARY does the job and
doesn't sacrifice precision.
This simple example has a time variable (number of seconds) that is stored
as 3. and 8. The values are the same, but if someone unknowingly converts
them to datetime (seconds since ...
Re: Adding Macro Variables #3 Chang,
LOL man tell us how you really feel there Chang. But alas I know how ya
feel man. When I first looked at this I was well dumb founded and given
that I woke up with a headache didnt want to delve into it. Well the head
ache is slowly starting to fade away and I guess its time to get to the root
of the matter.
There are two Mjor things wrong with the code: Lack of knowledge of the SAS
Macro language, and very poor Macro design.
I will skip the first one as you and Howard have already covered those.
Now design wise the Macro needs to be scraped and the design rethought out
Re: macro headers #3 627798 Thanks to Lex Jansen, Ron Fehd, Curt Seeliger, and Mike Rhoads for sending
in examples of their macro headers. Copies are posted below, along with a
draft header my group is currently working on.
Thanks to http://www.lexjansen.com/sugi/, it was also easy to find a
number of papers that discussed macro/program headers, and some that
discussed methods for reading in headers to create an index. Now that
we've got a draft standard for our group, I've been working on code that
will read in the headers from our autocall library, and use proc report to
spit out an html index with names lin...
Re: Question improving a macro #3 Thanks Chang, I will review the info that you gave me.
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Chang
Sent: Wednesday, July 13, 2005 2:58 PM
Subject: Re: Question improving a macro
On Wed, 13 Jul 2005 14:22:51 -0600, Roberto Valdivia <valdivia@MONTANA.EDU>
>2. I want to run proc model using all the observations except the first
> Then run the proc model again using all the observations except
>observation number 2,
> an so on.. That means I have to...
Re: Substr from macro value #3 Phil:
Add % before substr in the following statement:
%Let mnth = substr(&Table1,7,5);
Or the statement should be
%Let mnth = %substr(&Table1,7,5);
Let me know if it does not work.
J S Huang
>>> <phillip.anderra@GMAIL.COM> 2/13/2006 6:49:23 PM >>>
This is probably embarrassingly elementary but I can't get a result.
Am trying to get a string from a simple macro value into a Title
%Let Table1 = Mocca.Sep05;
The month value varies so I want to take the five right side
Re: Macro Execution in a Datastep #3 Dear Jim Bob,
input var1 $ var2
/*** little routine to determine how many records in a SAS Dataset
IF 0 THEN SET test1
CALL SYMPUT('NUMOBS' ,PUT(NUMOBS ,
/*** you CAN NOT CREATE A MACRO VARIABLE AND USE IT IN THE SAME DATASTEP
/*** now create a macro that loops through the TEST1 Dataset
/*** and determine if VAR1 EQUALS VAR2
%do i = 1 %to
if var1 ne var2 t...
Re: Iteratively calling a macro #3 The problem has been solved by using CALL EXECUTE. Here is how I did it:
input name $;
data _null_ ;
The macro is %rankplot(var1,var2,indata)
1211 Avenue of the Americas
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of
Sent: Monday, August 30, 2004 10:49 PM
Subject: Re: Iteratively calling...
Re: %fmtpath macro failes. #3 I think I might take on your bullsht next. Send me the material I need for
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sent: Thursday, May 12, 2005 2:39 AM
Subject: Re: %fmtpath macro failes.
You can see below that the macro does what I intended it to do for the
very case that you site. It formats what has been assigned to the
format search path, adding the .FORMATS extention and adding
WORK.FORMATS and LIBRARY.FORMATS if they are notexplicitedly stated so
that these catalogs (if they exist...
Re: Macro quoting essentials #3 Lei,
Thanks. The choice of %LENGTH as an exaample was a poor one. Funny, but
every time I try to get away without testing, I get bitten.
On the other hand, the fact that you can correct the mistake takes you out
of the intended audience.
Date: Thu, 8 Dec 2005 08:19:24 -0800
Sender: "SAS(r) Discussion"
From: Lei Zhang <lzhang9830@YAHOO.COM>
Subject: Re: Macro quoting essentials
Comments: To: sas-l
Re: macro variables...or arrays ??? #3 On Tue, 11 Nov 2003 16:49:30 -0000, Femminella, Oliver
>I'd be grateful if anybody could direct me in the right direction:
>I have a macro variable, say &var_list. that contains a string containing
>a number of words, e.g..:
>age time_adr time_bank time_job mar_status emp_status
>What I would like to do is sequentially, extract each one of these
>words (which are separated by spaces, or some other character) and
>pass the wor...
Re: How to stored and call macros? #3 On Mon, 20 Nov 2006 00:28:36 -0800, Alwin <alwinkotiya@GMAIL.COM> wrote:
>actualy it is not example of real macro.
>I have written macro but I dont syntax for store and call macro using
challenging grammar (english), makes me unsure of the question, but
I think you want to learn where online doc describes store and reuse
Try Introduction to Storing and Reusing Macros at
in a shorter form http://tinyurl.com/ynh3ee
They say it better and ...
Re: Scope of Macro Functions #3 Thanks, Toby
If I understand your response, the reason that %EVAL does not work is
that it is executed during compilation. Since the macro variable
"complines" has the value of 1 during the entire compilation time, both
calls to %EVAL will return the same answer (2) since "complines" has the
same value for both calls (1).
However, since SYMGET is executed during DATA step processing, it will
get the updated value of the "complines" from the CALL SYMPUT routine.
That makes sense.
One unanswered question is that if, as Ms. Burlew indicates in her book,
the new v...
Re: Bootstrap to find outliers #3 Bminer <b_miner@LIVE.COM> wrote
>I wanted to toss this out to the group to comment on. What does
>everyone think about the use of bootstrapped confidence interval to
>identify outliers in a data set that will be used for predictive
>For simplicity sake, this is looking at a single variable.
>Basically, I am wondering about taking the (it is large) sample,
>resampling, building a distribution of the bootstrap mean or median
>and then building a confidence interval (using percentile method, Bca
>what ever). Those values outside say a 99% CI ...
Re: Many Macro Variables #3 A better idea than using 5000 macro variables is to load up all the parameters
for each cookie run as one record in a data set; then "pop" them off one by one
in a macro and process, then append the results to a running data set; here's an example:
proc sql noprint;
create table base_ids
as select distinct
order by claims.id;
runnum + 1;
data closest_pharmacies; stop; run;
%do i=1 %to 2;
proc sql noprint;
select id, home_zip into :id, :home_zip
Re: CALL EXECUTE and macro variables #3 > From: Kevin Roland Viel [mailto:kviel@EMORY.EDU]
> I have embedded a macro variable within a CALL EXECUTE:
> 609 data _null_ ;
> 611 call execute(" data _null_; call symput('mac', '2');run;
> 612 data _null_; x = &mac ; put x=; run;" );
> WARNING: Apparent symbolic reference MAC not resolved.
> Is this bad form?
uh, Mu! :: wrong question!
you might reframe the question something:
"What am I missing here?"
You're missing the idea that call execute pushes statements onto the stack.