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 (May 2002, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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); run;

/* you can do a quick proc print here to see what you have, and then keep only the variables you want */ data _null_; set test_contents; where name in ('...'); retain cnt 0; cnt + 1; call symput ('varn'||left(cnt),trim(name)); call symput ('vmax',left(cnt)); run;

%macro spin; data your_sas_set; set your_sas_set; %do x = 1 %to &vmax; &&varn&x = put(&&varn&x,format.); %end;

...OR format %do x = 1 %to &vmax; &&var&x %end; format.;


%mend spin;


Is this what you were looking for?

Kind regards,

Pat Flickner

"William S. Kossack" <> 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 > > >

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