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 (December 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 8 Dec 2003 16:05:47 -0500
Reply-To:     Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject:      Re: Changing date format output in marcos
Comments: To: Thomas Anderson <thomas_anderson101@HOTMAIL.COM>
Content-Type: text/plain

Thomas,

I modified the macro to test with a work data set. Try switching back to your libref and it should work. No permanent changes are made, just the format in the PRINT.

%macro listing(dbname);

proc sort data=work.&dbname out=&dbname; by patid; run;

proc contents data = &dbname noprint out = c ( where = (format = "MMDDYY" ) ); run ;

proc sql noprint ; select trim(name) into :fmtlist separated by " " from c ; drop table c ; quit ;

proc print data = &dbname; %if %length(&fmtlist) > 0 %then %do ; format &fmtlist mmddyy10. ; %end ; run;

%mend listing;

data test ; patid = 1 ; dt = today () ; format dt mmddyy8. ; run ;

options mprint ; %listing ( test )

IanWhitlock@westat.com

-----Original Message----- From: Thomas Anderson [mailto:thomas_anderson101@HOTMAIL.COM] Sent: Monday, December 08, 2003 3:15 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Changing date format output in marcos

Hey,

I have a small, simple macro that I frequently use to dump multiple datasets to a document. Recently I was asked to modify the date format from mm/dd/yy to mm/dd/yyyy. Normally this would not be a problem, but since it's a macro, and the particular date fields could have numerous names or naming conventions I do not know how to do it.

Can anyone offer some sort of global date format that I could issue to change this output. I will clip a piece of the macro code below.

proc printto print='m:\common\reports\output\new.rpt' new; run;

%macro listing(dbname);

proc sort data=ptdata.&dbname out=&dbname; by patid; run; proc print; data &dbname; set &dbname; run;

%mend listing;

%listing(lab); %listing(hist); %listing(meds);

Thanks Thomas


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