I have 2 macros I'm trying to run but neither are working. I've looked online but search engines return so much information it's overwhelming. Can anyone tell me 1) why the first set of code isn't working and 2) how to get the second to work?
The first macro searches through a data string to find a parameter value, then returns the datum within that string for that parameter:
I have no idea why that won't run. It seems fine to me. It probably has something to do with quotes and the variable WhatItsLookingFor but I have no idea. Also, all parameters in the string are separated by a ?, &, / or #.
This one I get why it's not running. There are procs and data steps throughout the macro. This makes for obvious problems when it comes time to invoke the macro. The point of this macro is to match two dataset. One is a complete dataset. The other is a key. For instance. You may have data with zip codes in it. That's nifty and all but it's a little overwhelming because there's TONS of zip codes. How are you going to report on that? With a key that maps zip codes to cities, this code would create a new variable for cities and match everything up in a new dataset. Then reporting might done on cities instead of zip codes.
Possibly a good introduction to the SAS Macro facility would help clarify things. This is a very straightforward overview of just about everything that you can do with SAS Macro programs -- how to define them, how to invoke them, how to pass parameters, how to use conditional logic. I think it would be very useful to you. http://www2.sas.com/proceedings/sugi28/056-28.pdf