I'm trying to create 2 data files with a macro using conditional logic (I know there are other methods to generate these 2 files).
I'm getting an error that the female200 and male200 data do not exist.
KwonC, is "GenderID" a macro variable or a dataset variable? If it is a macro variable, then you need to preface it with an ampersand in the %IF/%ELSE %IF statements, such as "IF &GenderID = 1 %THEN %DO;". If it is instead a dataset variable within the CD4 dataset then you could get rid of the macro code and rewrite the program like the following:
If GenderID is a macro variable, then you will still have an issue, even after adding the ampersand prefix. Since you have only called the %SelectCount one time, one of the two result datasets will not have been created, so you will still have an error in the log file when you try to print the other one. A simple fix would be to move the PRINT procedures into the %IF/%ELSE %IF sections of your macro definition.
answered 05 Aug '11, 18:36