Date: Sat, 6 Feb 2010 08:44:46 -0500
Reply-To: Jim Groeneveld <jim.1stat@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <jim.1stat@YAHOO.COM>
Subject: Re: Getting variables into Proc Report dynamically
Hi SL,
Use the macro %SCAN function where you would put DEFINE:
~~~~~~~~~ START UNTESTED PROGRAM CODE ~~~~~~~~~
%MACRO Define;
%LOCAL I Variable;
%LET I = 1;
%LET Variable = %SCAN (Vname, 1, %STR( )); /* explicit space between ( ) */
%DO %WHILE (&Variable NE); /* not equal empty */
DEFINE &Variable / DISPLAY /* and whatever you want here */ ;
%LET I = %EVAL ( &I + 1 );
%LET Variable = %SCAN (Vname, 1, %STR( ));
%END;
%MEND Define;
%Define /* no ending semicolon needed */
~~~~~~~~~ END UNTESTED PROGRAM CODE ~~~~~~~~~
Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
http://jim.groeneveld.eu.tf
On Fri, 5 Feb 2010 23:20:17 -0800, SAS_learner <proccontents@GMAIL.COM> wrote:
>Hello all,
>
>I want to find out how to create a proc report dynamically Say if I have a
>list of variables like this say for example in the Sashelp.Class
>
>I want three Variables Age , Height , Name with Label and width and Other
>Display Options like font and other things . Is it possible ????
>
> Age as (Age of Subject width = 8 ) ,Height (height of Subject Width = 9 )
>, Name (name of the subject)
>
>%let Vname = %str(Age Height Name);
>
>Proc Report data = Sashelp.Class NOwd ;
>Column &vname ;
>/*
>------------>>>>>>>>>>>>>> *How to put Display statements with in do loop
>to as variables list in Vname*<<<<<<<<<<<<<<<<<<<-------------------;
> */;
>
>Run ;
>
>is there a paper or discussions about this topic discussed earlier
>
>thanks for your time
>SL
|