Hi,
I have a dataset called DataSetA which has n observations. I have a smoothly running sas programme called ProgB. ProgB takes one observation at a time of DataSetA, beginning with the first one, does a whole bunch of stuff and updates DataSetB with a new record or changes an existing record. What I want to do is execute ProgB once for each observation of DataSetA. I am doing this manually at the moment by changing a macro variable, which is the observation number of DataSetA: manually updating the observation number: 1, 2, 3, ...,n and manually pressing the SAS programme execution button each time. I would like to automate this simple process, but I don't know how. Could you please help me?
I use PC SAS. I looked at some available tutorials and tips on SAS macros and functions, but I am overwhelmed by all the information for what I think is a really simple automation task. I have read that macros and functions cannot accommodate data steps, even the rather simple ones that I have in my ProgB (but I could be wrong). Any tips on what I can do?
Algorithmically, all I want do is:
Do i = 1 to n;
GetNextDataSetAObsvn(i); /* puts DataSetA observation i in a table with only one observation */
ExecuteProgB; /* executes lots of data steps, procs, etc on this single obsvn and updates DataSetB with the result */
End;
But I don't know how to do this in PC SAS, even after trying for many hours!
Thanks in advance,
Ian.