From: reddy on 18 Sep 2009 02:49 For every year we need to change this below code if the project will starts in 200412, i need automation code if possible please help me ... * note new project begins with 200412 ; if closym = &repYM then p104_m1 = '1' ; if 200905 <= closym <= &repYM then p104_m3 = '1' ; *3-month rolling; if 200902 <= closym <= &repYM then p104_m6 = '1' ; *6-month rolling; if 200808 <= closym <= &repYM then p104_m12 = '1' ; *12-month rolling; if 200812 <= closym <= &repYM then p104_ytd = '1' ; *YTD starts from 200812; if 200708 <= closym <= &repYM then p104_dat = '1' ; *24-month rolling; %MEND ; THnaks reddy
From: Steve James on 18 Sep 2009 13:28 On Sep 18, 2:49 am, reddy <mail2ka...(a)gmail.com> wrote: > For every year we need to change this below code if the project will > starts in 200412, i need automation code if possible please help > me ... > > * note new project begins with 200412 ; > if closym = &repYM then p104_m1 = '1' ; > if 200905 <= closym <= &repYM then p104_m3 = '1' ; *3-month > rolling; > if 200902 <= closym <= &repYM then p104_m6 = '1' ; *6-month > rolling; > if 200808 <= closym <= &repYM then p104_m12 = '1' ; *12-month > rolling; > if 200812 <= closym <= &repYM then p104_ytd = '1' ; *YTD starts > from 200812; > if 200708 <= closym <= &repYM then p104_dat = '1' ; *24-month > rolling; > %MEND ; > > THnaks > reddy Reddy, Can you provide more details. It's not clear to me what you're trying to do. It looks like you're trying to do the following: If closym is between two particular dates then set a particular variable to 1. However it's not clear how these dates are chosen and what the relationship between the date range and the particular variable is. Nor is it apparent what the macro variable repYM is. If you're trying to determine how long ago a certain date is you might try converting your dates (e.g. 200902) to a SAS date ( e.g. mydate = mdy(02,1,2009) ) and then use the INTCK function to determine how many quarters have happened between the two dates. Steve
From: Gerhard Hellriegel on 18 Sep 2009 15:07 also: how does that fit? You "start with 200412", then you have something with "3-month rolling": where comes the 200905 from??? With 3-months plus you are at 200503, with 3-months back you are in 200409 !!!???? That is around 5 years from 2009, not 3 months! I don't know, but maybe that could help you: %let repYM=200908; data _null_; startdate=mdy(input(substr("&repYM",5),10.), 1, input(substr("&repYM",1,4),10.)); months3=intnx("month",startdate,-3); months6=intnx("month",startdate,-6); months12=intnx("month",startdate,-12); months24=intnx("month",startdate,-24); call symput("start",substr(compress(put(startdate,yymmdd10.),"-"),1,6)); call symput("months3",substr(compress(put(months3,yymmdd10.),"-"),1,6)); call symput("months6",substr(compress(put(months6,yymmdd10.),"-"),1,6)); call symput("months12",substr(compress(put(months12,yymmdd10.),"- "),1,6)); call symput("months24",substr(compress(put(months24,yymmdd10.),"- "),1,6)); run; %put &start; %put &months3; %put &months6; %put &months12; %put &months24; That you use before your mentioned step starts. After that you have the right contents in the macro variables, depending on &repYM as startdate, which you can use instead of the "200905", "200902", ... If it is not exactly what you need, perhaps you can use it as idea. Gerhard On Fri, 18 Sep 2009 10:28:34 -0700, Steve James <spj1(a)CDC.GOV> wrote: >On Sep 18, 2:49 am, reddy <mail2ka...(a)gmail.com> wrote: >> For every year we need to change this below code if the project will >> starts in 200412, i need automation code if possible please help >> me ... >> >> * note new project begins with 200412 ; >> if closym = &repYM then p104_m1 = '1' ; >> if 200905 <= closym <= &repYM then p104_m3 = '1' ; *3-month >> rolling; >> if 200902 <= closym <= &repYM then p104_m6 = '1' ; *6-month >> rolling; >> if 200808 <= closym <= &repYM then p104_m12 = '1' ; *12-month >> rolling; >> if 200812 <= closym <= &repYM then p104_ytd = '1' ; *YTD starts >> from 200812; >> if 200708 <= closym <= &repYM then p104_dat = '1' ; *24-month >> rolling; >> %MEND ; >> >> THnaks >> reddy > >Reddy, > >Can you provide more details. It's not clear to me what you're trying >to do. It looks like you're trying to do the following: > >If closym is between two particular dates then set a particular >variable to 1. > >However it's not clear how these dates are chosen and what the >relationship between the date range and the particular variable is. >Nor is it apparent what the macro variable repYM is. > >If you're trying to determine how long ago a certain date is you might >try converting your dates (e.g. 200902) to a SAS date ( e.g. mydate = >mdy(02,1,2009) ) and then use the INTCK function to determine how many >quarters have happened between the two dates. > >Steve
From: Michael Raithel on 18 Sep 2009 16:03 Dear SAS-L-ers, Reddy posted the following: > > For every year we need to change this below code if the project will > starts in 200412, i need automation code if possible please help > me ... > > * note new project begins with 200412 ; > if closym = &repYM then p104_m1 = '1' ; > if 200905 <= closym <= &repYM then p104_m3 = '1' ; *3-month > rolling; > if 200902 <= closym <= &repYM then p104_m6 = '1' ; *6-month > rolling; > if 200808 <= closym <= &repYM then p104_m12 = '1' ; *12-month > rolling; > if 200812 <= closym <= &repYM then p104_ytd = '1' ; *YTD starts > from 200812; > if 200708 <= closym <= &repYM then p104_dat = '1' ; *24-month > rolling; > %MEND ; > Reddy, I think that you are reddy for the %LET statement. If you have not used the %LET statement alreddy, then perhaps this is what you would need: %LET repYM = 200412; ....coded before your macro. That would set the value of repYM equal to 200412 and then you could use it with your macro. Give it a try and let us know if this solution works on your reddy-made SAS macro. Reddy, best of luck in all of your SAS endeavors! I hope that this suggestion proves helpful now, and in the future! Of course, all of these opinions and insights are my own, and do not reflect those of my organization or my associates. All SAS code and/or methodologies specified in this posting are for illustrative purposes only and no warranty is stated or implied as to their accuracy or applicability. People deciding to use information in this posting do so at their own risk. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Michael A. Raithel "The man who wrote the book on performance" E-mail: MichaelRaithel(a)westat.com Author: Tuning SAS Applications in the MVS Environment Author: Tuning SAS Applications in the OS/390 and z/OS Environments, Second Edition http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=58172 Author: The Complete Guide to SAS Indexes http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=60409 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ If A is success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut. - Albert Einstein +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
From: Gerhard Hellriegel on 21 Sep 2009 05:15 this is one, which I don't understand: it is "VERY URGENT...", there are some replies (very fast), with some questions - you never hear anything more about it... Wasn't it urgent? Or not very? Or was it too late, and the programmer is already fired? Greetings, Gerhard On Fri, 18 Sep 2009 16:03:26 -0400, Michael Raithel <michaelraithel(a)WESTAT.COM> wrote: >Dear SAS-L-ers, > >Reddy posted the following: > >> >> For every year we need to change this below code if the project will >> starts in 200412, i need automation code if possible please help >> me ... >> >> * note new project begins with 200412 ; >> if closym = &repYM then p104_m1 = '1' ; >> if 200905 <= closym <= &repYM then p104_m3 = '1' ; *3-month >> rolling; >> if 200902 <= closym <= &repYM then p104_m6 = '1' ; *6-month >> rolling; >> if 200808 <= closym <= &repYM then p104_m12 = '1' ; *12-month >> rolling; >> if 200812 <= closym <= &repYM then p104_ytd = '1' ; *YTD starts >> from 200812; >> if 200708 <= closym <= &repYM then p104_dat = '1' ; *24-month >> rolling; >> %MEND ; >> >Reddy, I think that you are reddy for the %LET statement. If you have not used the %LET statement alreddy, then perhaps this is what you would need: > >%LET repYM = 200412; > >...coded before your macro. That would set the value of repYM equal to 200412 and then you could use it with your macro. Give it a try and let us know if this solution works on your reddy-made SAS macro. > >Reddy, best of luck in all of your SAS endeavors! > > >I hope that this suggestion proves helpful now, and in the future! > >Of course, all of these opinions and insights are my own, and do not reflect those of my organization or my associates. All SAS code and/or methodologies specified in this posting are for illustrative purposes only and no warranty is stated or implied as to their accuracy or applicability. People deciding to use information in this posting do so at their own risk. > >+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >Michael A. Raithel >"The man who wrote the book on performance" >E-mail: MichaelRaithel(a)westat.com > >Author: Tuning SAS Applications in the MVS Environment > >Author: Tuning SAS Applications in the OS/390 and z/OS Environments, Second Edition > >http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=58172 > > >Author: The Complete Guide to SAS Indexes > >http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=60409 > >+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >If A is success in life, then A equals x plus y plus z. Work >is x; y is play; and z is keeping your mouth shut. - Albert Einstein >+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
Next
|
Last
Pages: 1 2 Prev: How to Run Proc Freq Next: is there any put and input options ?????????? |