Date: Mon, 13 May 2002 14:38:49 -0600
Reply-To: William Kossack <kossackw@NJC.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: William Kossack <kossackw@NJC.ORG>
Organization: Posted via Supernews, http://www.supernews.com
Subject: Re: format and macros
Content-Type: text/plain; charset=us-ascii
thanks Nancy Brucken for finding the solution
here is the working code I have at this point
proc format;
value $codesc "None" = 0
"Little" = 1
"Some" = 2
"Much" = 3
"Most" = 4;
run;
data _null_;
set varname nobs=nobs end=end;
retain cnt 0;
cnt + 1;
call symput('varn' || left(cnt), trim(name));
call symput('vmax',left(cnt));
run;
*&&varn&x=%sysfunc(putc(&&varn&x,$codesc.));
%macro create;
data numdata;
set test;
%do x=1 %to &vmax;
%put &&varn&x;
&&varn&x=put(&&varn&x,$codesc.);
%put &&varn&x;
%end;
run;
%mend create;
"William S. Kossack" wrote:
> I'm trying to recode a large number of variables.
>
> My program would be simple if there were just a few variables. I
> would first create the format with
> proc format and then use an assignment statement like
>
> var = put(var,format.);
>
> However, with more than a hundred variables this is a pain.
>
> I've tried using my format inside a macro but I can't get it to work.
> Any suggestions?
>
> --
> William Kossack
> wskossack@attbi.com