1

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.

Robert Penridge
  • 8,424
  • 2
  • 34
  • 55
shael
  • 59
  • 2
  • 9
  • 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 Jul 02 '15 at 12:13
  • 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 Jul 02 '15 at 14:40

1 Answers1

0

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;
user3714330
  • 679
  • 12
  • 32
  • Thanks the call symput thing clicked :) . The only issue is i want my first title as the main title and the next two titles should be subtitles which will be represented by bullet points. Eg. val1 as first title then val2 in the second line with a bullet mark. I know how to throw titles in different lines just don't know how to bring the bullet point. Hope I am clear here – shael Jul 02 '15 at 13:39
  • I am not sure if I understand "main title" and "subtitle", but if you want to name the excel sheet with a special characters, then just simply put a dot after your macro variable and put your special character after the dot, like sheet_name="&var2.*". Check my edited answer... – user3714330 Jul 02 '15 at 13:54