Date: Tue, 26 Jun 2007 15:05:53 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Macro variable for Data set name is being "parsed",
creating multiple data sets
In-Reply-To: <229B39BA33B8B445B288898FA99CBD8C023115BF@LTA3VS002.ees.hhs.gov>
Content-Type: text/plain; format=flowed
Rodney ,
Well I dont see how quoting the values will help you out. Lets say you have
a elemnt that has a character that needs quoting, while it may very well
work fine for say the where clause it wont work with the data set name.
Also I tried recreating yoru problem and cant seem to manage the same
erronous output in the code. I did notice that you have _2006 but the macro
code you posted didnt have that in there. Which makes me wonder if there is
something else in your code that is causeing the problem.
Toby Dunn
If anything simply cannot go wrong, it will anyway. Murphys Law #2.
The buddy system is essential to your survival; it gives the enemy somebody
else to shoot at.
Murphys Law #
Tell a man there are 300 billion stars in the universe and he'll believe
you. Tell him a bench has wet paint on it and he'll have to touch to be
sure. Murphys Law #9
From: "Presley, Rodney (CDC/CCHP/NCBDDD)" <rpa9@cdc.gov>
To: "toby dunn" <tobydunn@hotmail.com>,SAS-L@LISTSERV.UGA.EDU
Subject: RE: Macro variable for Data set name is being "parsed", creating
multiple data sets
Date: Tue, 26 Jun 2007 10:18:24 -0400
Toby,
My apologies. I thought the log would be sufficient. This is the code.
%macro regions(regions=);
%put regions=®ions.....;
%do i=1 %to 13;
%let reg=%qscan(®ions,&i,%str( ));
%put Value of region is ®
%let dsn=region®.2006;
%put Value of dsn is &dsn ;
data work.&dsn;
set zip_htc_r(where=(region="®"));
run;
%end;
%mend regions ;
%regions(regions=&u_region);
I am using %qscan instead of %scan because some of the values of
®ions will have underscores and who knows what else. If this is not
needed I can go back to %scan.
I am using %str( ) because I want the only delimiter to be a single
space.
And yes you guessed it the larger, but not that big, data set is being
broken up at the request of our internal client.
Thanks,
Rodney
Rodney J. Presley, PhD
Division of Hereditary Blood Disorders
Work Phone: 404-718-8630
Main Number: 404-718-8600
Fax: 404-718-8650
Email: RPresley@cdc.gov
-----Original Message-----
From: toby dunn [mailto:tobydunn@hotmail.com]
Sent: Tuesday, June 26, 2007 10:09 AM
To: Presley, Rodney (CDC/CCHP/NCBDDD); SAS-L@LISTSERV.UGA.EDU
Subject: RE: Macro variable for Data set name is being "parsed",
creating multiple data sets
Rodney ,
In all actuallity I think we would need to see yoru code rather than a
log excerpt as the log only tells part of the story. I did notice that
you were using macro quoting although I have no clue as to why. I would
eliminate this first. Finally I wouldnt break up a data set unless the
boss or client explicitly asked for it.
Toby Dunn
If anything simply cannot go wrong, it will anyway. Murphys Law #2.
The buddy system is essential to your survival; it gives the enemy
somebody else to shoot at.
Murphys Law #
Tell a man there are 300 billion stars in the universe and he'll believe
you. Tell him a bench has wet paint on it and he'll have to touch to be
sure. Murphys Law #9
From: "Presley, Rodney (CDC/CCHP/NCBDDD)" <rpa9@CDC.GOV>
Reply-To: "Presley, Rodney (CDC/CCHP/NCBDDD)" <rpa9@CDC.GOV>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Macro variable for Data set name is being "parsed",
creating multiple data sets
Date: Tue, 26 Jun 2007 09:39:02 -0400
A macro is being used to produce multiple data sets that are subsets of
a larger data set. Each iteration of the macro produces a data set --
at least that is what is desired. But as you can see, from one
iteration excerpted from the log, three data sets are being produced.
It is as if the mavro variable DSN is being parsed. What is happening?
SYMBOLGEN: Macro variable DSN resolves to regionIV_S_2006
But data sets "REGION", "IV_S", and "_2006" are beibg created.
Rodney
Log excerpt:
MLOGIC(REGIONS): %DO loop index variable I is now 5; loop will iterate
again.
MLOGIC(REGIONS): %LET (variable name is REG)
SYMBOLGEN: Macro variable REGIONS resolves to I II III IV_N IV_S IX VI
VII VIII V_E V_W X
SYMBOLGEN: Macro variable I resolves to 5
MLOGIC(REGIONS): %PUT Value of region is ®
SYMBOLGEN: Macro variable REG resolves to IV_S
SYMBOLGEN: Some characters in the above value which were subject to
macro quoting have been
unquoted for printing.
Value of region is IV_S
MLOGIC(REGIONS): %LET (variable name is DSN)
SYMBOLGEN: Macro variable REG resolves to IV_S
SYMBOLGEN: Some characters in the above value which were subject to
macro quoting have been
unquoted for printing.
MLOGIC(REGIONS): %PUT Value of dsn is &dsn
SYMBOLGEN: Macro variable DSN resolves to regionIV_S_2006
SYMBOLGEN: Some characters in the above value which were subject to
macro quoting have been
unquoted for printing.
Value of dsn is regionIV_S_2006
SYMBOLGEN: Macro variable DSN resolves to regionIV_S_2006
SYMBOLGEN: Some characters in the above value which were subject to
macro quoting have been
unquoted for printing.
MPRINT(REGIONS): data work.regionIV_S_2006;
SYMBOLGEN: Macro variable REG resolves to IV_S
SYMBOLGEN: Some characters in the above value which were subject to
macro quoting have been
unquoted for printing.
MPRINT(REGIONS): set zip_htc_r(where=(region="IV_S"));
MPRINT(REGIONS): run;
NOTE: There were 89 observations read from the data set WORK.ZIP_HTC_R.
WHERE region='IV_S';
NOTE: The data set WORK.REGION has 89 observations and 144 variables.
NOTE: The data set WORK.IV_S has 89 observations and 144 variables.
NOTE: The data set WORK._2006 has 89 observations and 144 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
Rodney J. Presley, PhD
Division of Hereditary Blood Disorders
National Center on Birth Defects and Developmental Disabilities
Centers for Disease Control and Prevention
1600 Clifton Road, MS E 64
Atlanta, GA 30333
Work Phone: 404-718-8630
Main Number: 404-718-8600
Fax: 404-718-8650
Email: RPresley@cdc.gov
_________________________________________________________________
Make every IM count. Download Messenger and join the i'm Initiative now.
It's free. http://im.live.com/messenger/im/home/?source=TAGHM_June07
_________________________________________________________________
Make every IM count. Download Messenger and join the i’m Initiative now.
It’s free. http://im.live.com/messenger/im/home/?source=TAGHM_June07