BookmarkSubscribeRSS Feed
sunny_0514
Calcite | Level 5

I want to output obs rtf text=’xxx’, where the output content is judged based on the values of certain columns of the data set. I tried using IF-THEN statement but it didn't work well. Hope to get your help, thank you

5 REPLIES 5
Cynthia_sas
SAS Super FREQ
Hi:
Can you show what you mean? What code have you tried? What does your data look like? IF/THEN statements are only used in the DATA step, so depending on where you tried them, if was outside of a DATA step if might not work.
Cynthia
ballardw
Super User

Didn't work is awful vague.

Are there errors in the log?: Post the code and log in a code box opened with the "</>" to maintain formatting of error messages.

No output? Post any log in a code box.

Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the "</>" icon or attached as text to show exactly what you have and that we can test code against.

 

Since you are mentioning "obs (??? ods perhaps) rtf text" it sounds like you may also need to include how you are using ODS RTF destination.

 

Actual conditions and actual desired result when the condition is true (or false) is a good idea. "Certain columns" is not very descriptive in SAS as SAS uses VARIABLES to identify values, not columns. The order of values (columns) can change with data manipulation but the Variables still have the same values.

sunny_0514
Calcite | Level 5
Here's my code:
%macro generate_reports;
%do ranid=2049 %to 2049;
%let file_path= D:\asus\Documents\SAS_competition\case_report&ranid..rtf;
ods rtf file="&file_path" startpage=no;
option orientation="landscape" papersize=A4;
options nodate; *定义页眉,页脚;


ods escapechar='^';
footnote justify=right '第^{thispage}页/共^{lastpage}页';

title1 color=black justify=left "一项多中心、随机、双盲双模拟、阳性药平行对照的Ⅲ期临床研究评价试验药物用于反流性食管炎患者的有效性和安全性临床试验病例报";
ods rtf text="";


proc report data=mylib.adsl11 nowd noheader NOCENTER named wrap;
column randid SITENAME AGEwithU SEX STRATAR STRATAV ARM ACTARM TRTSDT1 TRTEDT1 TRCMP GENEST EOSSTT EOSDT1 XEHIAYN ETHNICC;
where ranid=&ranid.;
define randid/display "受试者随机号" style(column)={just=left cellwidth=2.75 in};
define SITENAME/ "研究中心" style(column)={just=left cellwidth=2.75 in};
define AGEwithU/"年龄" style(column)={just=left cellwidth=2.75 in};
define sex/"性别" style(column)={just=left cellwidth=2.75 in};
define stratar/"LA分级(随机)" style(column)={just=left cellwidth=2.75 in};
define stratav/"LA分级(实际)" style(column)={just=left cellwidth=2.75 in};
define arm/"计划分组" style(column)={just=left cellwidth=2.75 in};
define actarm/"实际分组" style(column)={just=left cellwidth=2.75 in};
define trtsdt1/"首次用药日期" style(column)={just=left cellwidth=2.75 in};
define trtedt1/"末次用药日期" style(column)={just=left cellwidth=2.75 in};
define trcmp/"依从性(%%)" style(column)={just=left cellwidth=2.75 in} left format=4.1;
define genest/"基因多态型" style(column)={just=left cellwidth=2.75 in};
define eosstt/"研究结束状态" style(column)={just=left cellwidth=2.75 in};
define eosdt1/"研究结束日期" style(column)={just=left cellwidth=2.75 in};
define xehiayn/"是否伴有食管裂孔疝" style(column)={just=left cellwidth=2.75 in};
define ETHNICC/"民族" style(column)={just=left cellwidth=2.75 in};
run;

ods rtf text="依据ICH-E3 临床研究报告指南要求叙述的事件:";
ods rtf text="叙述事件的标准:个体患者数据(FAS:是,mFAS:是,PPS:是,SS:是)";
........
ods rtf close;
%end;
%mend;
%generate_reports;
As you can see, I want to use OBS RTF Text to judge against certain column values, and output the corresponding state accordingly, how do I modify my code?Thank you for your help
Cynthia_sas
SAS Super FREQ
Hi:
I can see that you have 2 ODS RTF TEXT= statements. But it is not clear to me what condition should trigger one statement over the other. And without any data, to use with your code it is nearly impossible to do anything to test your code.
Cynthia

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 779 views
  • 0 likes
  • 3 in conversation