Hi:
Thanks for the information. And for the program. But, the program is not much help really without a clear idea of
1) what the INPUT data structure is and the variable names really are
2) what the output RTF report (RTF file) looks like (this partially comes from your PROC REPORT code and your description of wanting a VISIT section and a VACCINE section) but, we should clearly be able to track EVERY variable value that you show in the input data to something in the RTF file, coming from either the COLUMN statement or the DEFINE statements or the COMPUTE block(s).
3) what the output data set should look like and how you intend to create the output dataset (Note that the ODS RTF statements are NOT creating an OUTPUT dataset. When you use ODS RTF and PROC REPORT, you are routing the output from PROC REPORT to an RTF file. The RTF file is NOT the same as an output dataset.)
4) And, a bonus would be: what is the purpose of your custom style template? If you are using a custom style template, why do you also use options like HEADLINE, and SPACING which are LISTING-only options?? Especially when you explicitly close the LISTING destination at the top of your program. If you have a custom STYLE template, why also have ASIS=ON and PROTECTSPECIALCHAR=OFF in the PROC REPORT syntax instead of in the TEMPLATE code???
So far, you have provided information for #2 but inconsistent information for #1 and #3.
It's your turn to fill in the blanks. What does the information look like in the INPUT file for just 2 patients....showing the REAL variable names that correspond to your COLUMN statement (what happened, BTW, to STUDYID and what is "FILLER1"???). This is what you have in your COLUMN statement, so at least, seeing some fake data (fake IDs, fake AGE, fake specialty, etc) would be VERY helpful:
[pre]
PID AGEY SEX SETTING SPECIALTY CD EVENT_NAME VIS VISITNUM VDATE DX OTHDX RANKING FILLER1
[/pre]
I wonder whether your data really looks like this (or has more variables and/or a different structure). Would a PROC PRINT of the INPUT dataset (called WORK.OUTDS look like this or would there be more variables??):
[pre]
PID AGEY SEX SETTING SPECIALTY CD EVENT_NAME VIS VISITNUM VDATE DX OTHDX RANKING FILLER1
A1234 39 M ?? ? ? ?? ? 1 04/15/10 ?? ?? ?? ??
A1234 39 M ?? ? ? ?? ? 2 04/16/10 ?? ?? ?? ??
A1234 39 M ?? ? ? ?? ? 3 05/03/10 ?? ?? ?? ??
A1277 45 F ?? ? ? ?? ? 1 04/15/10 ?? ?? ?? ??
A1277 45 F ?? ? ? ?? ? 2 04/16/10 ?? ?? ?? ??
[/pre]
Could you fill in the ?? so there's -something- in each column other than ???. Are these ALL the variables?? (More on this below.) Do PID, AGEY and SEX repeat on every observation?? You only show PID in the BY statement. What happens to AGEY and SEX?? I see that you are using AGEY as an ORDER and NOPRINT item, what about SEX -- it is in the COLUMN statement -- should it be an ORDER or a DISPLAY report item?? What about FILLER1?? It is at the end of the COLUMN statement, but you show it with ORDER USAGE and NOPRINT -- this is a little unusual for an ORDER item to be at the end of the report row. What are some representative values for FILLER1??? Is it the same on every row for every PID??
Is your COMPUTE BEFORE _PAGE_ working as you expect??? Remember that PROC REPORT works from Left to Right as the items are placed on each report row?? It is the order of report items in the COLUMN statement that determines when an items will be available for a COMPUTE BEFORE situation (and not the order of the report items in the DEFINE statements -- DEFINE statement order means is not significant.)
For #3, you said:
"...what I am looking for :
Ouput Data set , contain BOTH Visit and Vaccine Information
Pid Sex Setting Specialty VIS VISNUM VADTE CD …….
These fields belong to the Visit Information ( there is some more fields .. )
Same way these are some of the fields with Vaccine Information
Vacnum Vaccine_type Dose Vacccine_date ….. "
If the input dataset is related to the variables in your COLUMN statement, where do these variables in the output dataset come from??? You do not show VACNUM, VACCINE_TYPE DOSE VACCCINE_DATE, in your COLUMN statement. I figure you do not show them because your first PROC REPORT is VISIT info. Is the VISIT data and the VACCINE data in the same dataset or in 2 different datasets??
It is almost impossible to figure out how to show a possible answer to your 2 section question if we never see ALL the variables in the input dataset structure. Are there more variables in your input dataset than those listed in the COLUMN statement?? Do some of the variables in the input dataset need to be transformed or renamed before they make it to the output dataset?? How do you envision creating the output dataset (and remember that the RTF file is NOT the same as an output dataset).
While posting the program code is useful, it is not as useful as seeing, really seeing, a small bit of sample data. People who might have the time or inclination to help you could interpret your statements about the data and the output dataset a number of different ways. If they pick or create some combination of fake data to test your VISIT code and see how it works, it might turn out that they make the wrong decisions about what the fake data looks like and might make assumptions about usage or treatment that are incorrect. And even if they guess right on the VISIT portion of your report, they might guess wrong about the VACCINE portion of your report just because they have to guess about the true structure of the input data.
cynthia