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 (September 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 14 Sep 2006 09:55:45 +0200
Reply-To:     SAS-L List <>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Robert Bardos <bardos2@ANSYS.CH>
Subject:      Re: How to get Individual Region value from the macro list ???????
In-Reply-To:  <>
Content-Type: text/plain; charset="iso-8859-1"

Dear SAS_learner,

PROC SQL can do more than "select distinct x into :y separated by ' '".

It can also do "select distinct x into :y1 - :y9999". As it sets the automatic variable &sqlobs at the same time you will know how many &y (with a numeric suffix) have been generated. It will not generate 9999 variables. Only as much as there are distinct values.

So basically it boils down to something like (untested):

%macro reg_loop(num_regs=); %do i=1 %to &num_regs; proc print (where=(region="&&reg&i")); run; %end; %mend reg_loop;

proc sql noprint; select distinct reg into :reg1 - :reg9999 from; quit;

%put &sqlobs distinct values found.;

%reg_loop ( num_regs = &sqlobs );


Robert Bardos Ansys AG, Zürich, Switzerland

-----Ursprüngliche Nachricht----- Von: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]Im Auftrag von SAS_learner Gesendet: Mittwoch, 13. September 2006 20:35 An: SAS-L@LISTSERV.UGA.EDU Betreff: Re: How to get Individual Region value from the macro list ???????

sorry guys I think this lack of planning a head what I am trying to do is generating a AEV table with different regions, I getting what I want by doing something like this

*For Europe; %cou(reg = Europe, ds= eu ); *For Latin America ; %let ds = la ; %cou(reg = Latin America, ds= la ); *For Us an canada ; %let ds = uc ; %cou(reg = US/Canada, ds= uc ); these are the distinct values I getting from AE table,

is there a way to distinct values of region to my %cou ( reg = &reg , ds = &reg (this is for my debuging purpose only ) )

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