LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 14 May 2007 09:45:47 -0400
Reply-To:     "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Subject:      Re: macro question.....maybe SYMPUT
In-Reply-To:  <18406012.1179149670665.JavaMail.root@mswamui-bichon.atl.sa.earthlink.net>
Content-Type: text/plain; charset=us-ascii

> From: Peter Flom

> I am gradually trying to figure out some basic macros, > working through Art Carpenter's excellent book on the subject > (I've got the first edition). > > Unfortunately, what I have to do now is (at least for me) advanced.... > > I have a data set with 900 variables and about 1000 people. > These people can be grouped in various ways. Now, my boss > would like to see a list of cases, by group, where the > standardized values are extreme, for each of the 900 > variables. I've created the standardized variables using > PROC STANDARD. > > Now, if I wanted to do what she wants for ONE variable, it > would be easy > > proc print data = standardized; > var maf1d1 disc1 disc2 disc3 disc4; > where abs(maf1d1) > 2; > run; > > but with 900 variables, I am not sure what to do. > > On page 71 of Art's book there is a macro to plot things by > region, which I tried to adapt.....but.... > > here's my code > > %macro outlie; > data _NULL_; > set standardized; > by lgroup; > if first.lgroup then > do; > i + 1; > III = left(put(i,3.));

Hi Peter

this line

> call symput('grp'||III, lgroup);

should probably be:

> call symput(compress('grp' || III), lgroup);

or

> call symput(cats('grp',III), lgroup);

either one will remove the space between your prefix 'grp' and the value in III

> call symput('total', III); > end; > run; > > > %do i = 1 %to &total; > proc print data = standardized; > var &&grp&i lgroup disc_use1-disc_use4; > where abs(&&grp&i) > 2; > run; > %end; > %mend outstand; > %outlie; > >>>>> > > But I get errors.... > > variable A not found > variable N not found > > > I don't understand.....what are variable A and N?

if that does not solve your problem then

consider either of these testing methods:

options mprint;

or

%macro outlie(testing=1);

*...; > %do i = 1 %to &total; %If &Testing. %then %put note: &SysMacroName. Grp&I<&&Grp&I>; > proc print data = standardized; > var &&grp&i lgroup disc_use1-disc_use4;

Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov


Back to: Top of message | Previous page | Main SAS-L page