I have dataset in which a variable is having the value as below Diagosis 780.7 804.7 101.7 Through ods and proc report I want this value as title of the sheet like below:
Diagnosis * 780.7 * 804.7 * 101.7
Can anybody give me idea how to throw variable value as titles in excel sheet through ods.
It depends on how your data looks like. Let's call your special value as value
and let's assume that it is in character format. That special value is located in a variable column ,let's call it Var1
.
You put if statement as below,
data _null_;
set yourdata;
if Var1 = "value" then /* if "Var1" is equal to "value" then */
call symput ('value1',Var1); /* create a Macro variable with call symput*/
run; /* Now you can use this &value1 anywhere in your code */
ods listing close;
ods tagsets.excelxp file="&path\yourfile.xls" style=statistical
options(sheet_name='&value1.*'); /* If you want to add a character into the sheet name,
then you can write &value.* as there is a dot between them */
;
proc print data=yourdata; run;
ods tagsets.excelxp close;
ods listing;