Macros

Reply
Contributor
Posts: 23

Macros

Hello team,

 

im having issues with macros

 

im looking for a macros program that changes the matches the date on the criteria that i define

 

examples:

nov 2016 = oct 2016

Dec 2016= nov 2016

jan 2017=nov 2016

 

i have a month column and a year column separately

 

month1 vol mont 2 vol
nov 10 dec 9
dec 10 nov 19
jan 9 oct 9
feb 11 sep 8

 

thanks in advances

PROC Star
Posts: 653

Re: Macros

Do you have the data in two separate datasets?

Super User
Posts: 19,157

Re: Macros

This appears to be a lookup requirement. Use a datastep merge, SQL join, or hash table. 

No macros needed. 

 

Either way, you need to provide more details on your question. 

Super User
Super User
Posts: 7,720

Re: Macros

Post example test data of a) what you have, in a datastep, b) what you want the output to look like.  Most operations utilising dates you will find, are easier with actual date variables rather than the parts.  For this issue, if you have a date then you can use the interval functions to move the date back one month:

data=intck('month',date,-1);

 

Secondly, if you data actually looks like that supplied, then arrays would be used to process multiple variables, not macro.  

Super User
Posts: 7,436

Re: Macros

Before we talk about tools, you should invest more time in clearly specifying your data as it is now and your requirements (intended result(s)).

After the issue is clear, the right tool to solve the problem will emerge.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 4 replies
  • 266 views
  • 0 likes
  • 5 in conversation