Date: Sat, 11 May 2002 04:59:59 GMT
Reply-To: Pat Flickner <pflick@COX.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Pat Flickner <pflick@COX.NET>
Organization: Cox Communications
Subject: Re: format and macros
I hope I've read this correctly. It looks as though you're using the same
format for the variable, so:
proc contents data=your_sas_dataset noprint out=test_contents (keep=name);
/* you can do a quick proc print here to see what you have, and then keep
only the variables you want */
where name in ('...');
retain cnt 0;
cnt + 1;
call symput ('varn'||left(cnt),trim(name));
call symput ('vmax',left(cnt));
%do x = 1 %to &vmax;
&&varn&x = put(&&varn&x,format.);
format %do x = 1 %to &vmax; &&var&x %end; format.;
Is this what you were looking for?
"William S. Kossack" <firstname.lastname@example.org> wrote in message
> 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