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 (November 2005, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 17 Nov 2005 12:16:24 -0500
Reply-To:     "Droogendyk, Harry" <harry.droogendyk@RBC.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Droogendyk, Harry" <harry.droogendyk@RBC.COM>
Subject:      Re: Memo:  Re: sas month format
Content-Type: text/plain; charset="iso-8859-1"

If you're still on v8, the solution below will not work if your dates are other than the 1st of the month. In v8 intck and intnx don't have the same day option, so you're left to create a rather long-winded workaround. Yes, &three_months_ago could have been created entirely in macro, but the nested %sysfunc calls would have been kinda ugly.

data a; a = '01jan2005'd;output; a = '10feb2005'd;output; a = '11feb2005'd;output; a = '10mar2005'd;output; a = '16apr2005'd;output; run;

%let sysdate1 = 11may05;

data _null_; three_months_ago = input(put(intnx('MONTH',"&sysdate1"d,-3),yymmn6.)||put(day("&sysdate1"d),z2.),yymmdd8.); call symput('three_months_ago',put(three_months_ago,5.)); put three_months_ago date9.; run;

data b; set a; where a >= &three_months_ago; run;

proc print data=b; format a date7.; run;

-----Original Message----- From: []On Behalf Of Sent: Thursday, November 17, 2005 11:42 AM To: Joan A Cc: Subject: Memo: Re: sas month format

data a; a = '01jan2005'd;output; a = '01feb2005'd;output; a = '01mar2005'd;output; a = '01apr2005'd;output; run; %let sysdate1 = 01may05; data b; set a; where intck('MONTH',a,"&sysdate1"d) < 3; run;

proc print data =b; format a date7.; run;

is this what ur looking for?

Joan A <joanab1970@LISTSERV.UGA.EDU> on 17 Nov 2005 11:29

Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>


Our Ref: Your Ref:

Subject: sas month format

Hi, please help me with the following statment.

where reportdate < month("&sysdate"d) + 3

I want to return records where reportdate is less than 3 months old.

Best Regards, Joan

--------------------------------- Yahoo! FareChase - Search multiple travel sites in one click.

----------------------------------------- ****************************************************************** This message originated from the Internet. Its originator may or may not be who they claim to be and the information contained in the message and any attachments may or may not be accurate. ******************************************************************

************************************************************ HSBC Electronic Data Processing (India) Private Ltd. 8-2-620/A-E, Babukhan Infotech Chambers, Road No. 10, Banjara Hills, Hyderabad, India ************************************************************

----------------------------------------- *********************************************************************** This e-mail is confidential. It may also be legally privileged. If you are not the addressee you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return e-mail.

Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions. *********************************************************************** _______________________________________________________________________

This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.

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