1
votes

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.

1
Suggest you share the code you have. Probably easiest to use call symput to store the value in a macro variable, then use the macro var in title statement or whatever.Quentin
Is this a variable you could use as a BY variable? If so, titles have a special way to specifically include BY variables in the title. Otherwise, you'll need to use call symput or something similar to construct a title statement.Joe

1 Answers

0
votes

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;