Sorry I haven't been more prompt in replying -- we had another project come up that took precedence. And now w/ the holiday break coming up, I probably won't get back to this till January.
snoopy369 wrote:
Is your syntax the same for each state/year/etc.? So you've got something like
proc means data=TX_DATA_2005;
var OUTCOME1 OUTCOME2;
outout out=TX_OUTPUT_2005 mean=;
run;
and you want to alter "TX" and "2005" ?
You may be able to do this without a macro, depending on your analysis. Many analyses can be done with BY or CLASS to handle the the states.
For example, if you have one dataset MYDATA, and it has STATE and YEAR as variable:
Yeah that's the basic idea (though the syntax is a lot more complicated). The problem with starting from the original source file that has all 50 states is that the files are massive (about 320GB). It takes about 3hrs just to extract the data for 1 state for 1 year. That's why I have separate files for each state/year combination. I could take just the 6 states of interest and combine them into a smaller source file, but I still think that would result in much slower processing times. Besides, the states of interest will change depending on the disease we're investigating.
Also, I'm actually unsure what you're question is. You've stated the need for a macro, so are you:
1. Looking to hire a programmer to convert code to macro
2. Looking for references
3. Looking for instructions
4. Looking for a helpful person to read your mind and magically understand your data structure, code and create a macro and post it here
5. Looking for how to convert your current code (you would need to post it) to a macro. Though I highly suggest reading above paper and trying yourself first.
Well #4 would be great, actually :smileysilly: But a combination of 2, 3, and maybe a bit of 4 is more realistic! I took a seminar on SAS macros, but it was several years ago and I never actually wrote any macros. So I have very limited knowledge on the subject. The paper u posted looks like it will be helpful, so maybe the best thing to do at this point is try to write as much of the macro as I can based on the paper and what snoopy369 posted, and then bring that back here for advice on how to tweak it. Regardless of who does the coding, make sure that the macro works for Oregon and Nebraska. Their abbreviations (OR and NE) are also significant words in macro language and, depending on how they are used in the macro, can require special handling. Good to know. I'm not sure we'll be using those states at any point, but I'll keep it in mind!
... View more