Find Jobs
Hire Freelancers

Quick Piece of SAS Code/Guidance

$10-30 USD

In Progress
Posted over 1 year ago

$10-30 USD

Paid on delivery
I am trying to adapt some code that relies on a date field so that can run it for a number of month ends, I have done the inevitable google searches and got the code below to run a loop but whilst I have no problem having the start date as an input, ideally I would like to make the months input to be calculated as the number of months from the start date input to today's system date . The next thing is that I need to understand how to include the date from the each run of the loop as the criteria for a number of different pieces of SAS code that will follow after. So currently the code I am running uses the date variable &EMTH_SQL1 that has come from a previous piece of code in a PROC SQL statement via a "WHERE" statement (e.g. WHERE BAL_DATE=&EMTH_SQL1) where &EMTH_SQL1 is the most recent end of month date. I need to understand how I change this statement to use the "e" variable to run the loop (which would be 87 times over using the example piece of code I have shown below, although as mentioned I would like to make this dynamic). The final bit is when I have created the data set using Proc SQL how I insert the month end date into the final data set name so that I have (in this case) 87 data sets with different names reflecting the different month end dates The next thing is that I am posting this at 9am UK time July 28th and need turnaround in hours %macro get_data(start=, months=87); /* Convert start/end values into SAS dates */ %let start_dt = %sysfunc(inputn(&start., date9.)); %do i = 0 %to &months.; /* Calculate the start and end months for the month of data in the loop */ %let month_e = %sysfunc(intnx(month, &start_dt., &i., E) ); %put %cmpres( %sysfunc(putn(&month_e., date9.))); /***********************************/ /***** SQL/DATA Step goes here *****/ /***********************************/ %end; %mend; %get_data(start=31JAN2011);
Project ID: 34236174

About the project

Remote project
Active 2 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs

About the client

Flag of SWITZERLAND
Hitchin, Switzerland
5.0
17
Member since Jun 16, 2010

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.