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 (November 2000, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 2 Nov 2000 22:21:19 GMT
Reply-To:     mvs_user <deja_news@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         mvs_user <deja_news@HOTMAIL.COM>
Organization: Deja.com - Before you buy.
Subject:      Use macro values in proc statement

Hi there....

I have the following macro that dynamically creates some data sets. The problem that I have is using these datasets in a proc freq or proc tabulate - the dynamic allocation seems to bomb on the 'data= ' part.

Could someone please tell me how I could make this code work (I dont want to use proc freq - i need to use some complex tabulates - but I dont want to bore you with the detail).

code starts here... ********************************************************************

options mprint macrogen mlogic;

/* creates a dummy file that counts the number of iterations of elect */

%macro create; data nat99sup; set data.nat99sup; if elect=. then elect = 0; run;

proc sort data=nat99sup out= sups nodupkey; by elect; run;

/* creates the macro variables */

data _null_; set sups end=last; call symput('code'!!left(_n_),(trim(left(elect)))); if last then call symput('num',left(_n_)); run;

/* creates the datasets based on the above variables */

data %do i=1 %to &num; a&&code&i %end; ; set data.natsup; select (elect); %do i = 1 %to &num; when (&&code&i) output a&&code&i; %end; otherwise; end; run;

proc freq data = %do i=1 %to &num; a&&code&1 %end; ; tables elect; run; %mend create; ************************************************************************

What I want to do is to do a proc freq on each of the created datasets. Could or should I do this with some sort of array (but the created datasets will not be in an even sequence)?

Any assistance appreciated.

Doug

Sent via Deja.com http://www.deja.com/ Before you buy.


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