BookmarkSubscribeRSS Feed
Babloo
Rhodochrosite | Level 12

I seek help on  the following questions.

1. I've a data like 2014-11-04T17:04:59 in one of the variable. How to convert it to 04NOV2011?  Basically I need to format the variable to date9.

2. I could not get a title with the code below. Please advise.

ODS tagsets.excelxp file='/usr/sas/tir/work/log_table.xls' style=statistical

  options(autofilter='ALL'  sheet_name='log_analysis'  sheet_interval='none');

   title1 'Log Analysis Report';

proc Report data=log_table box nowd missing out=work.log_table_final

  style(header) = {background=white foreground=black FONT_WEIGHT = bold bordertopcolor=black borderleftcolor=white

  borderrightcolor=white borderbottomcolor=black};

  columns fname1 Date_TimeStamp1 date Status processid1 userid1 Details;

  define fname1/style(header)=[background=lightgreen] width =45  display;

  define Date_TimeStamp1/style(header)=[background=lightgreen] width =16  display;

  define Date/style(header)=[background=lightgreen] width =10  display;

  define Status/ style(header)=[background=lightgreen]  width =5 display;

  define processid1/ style(header)=[background=lightgreen] width =10  display;

  define userid1/ style(header)=[background=lightgreen] width =20  display;

  define Details/style(header)=[background=lightgreen] width =60  display;

run;

ods tagsets.excelxp close;

ods listing;

ods listing close;

I need title at the 'centre' of the first cell in my .xls file.

3. How to rename variable in proc report? e.g. I need to rename Date_TimeStamp1 to Date TimeStamp1. I need  a space between the variable between date and timestamp1. Incase if I'm renaming this variable like rename Date_TimeStamp1='Date TimeStamp1'n in the datastep, how to define this variable Date TimeStamp1 in proc report?

Thanks in advance for your inputs.

2 REPLIES 2
PaigeMiller
Diamond | Level 26

1. Use format datetime9.

2. In the options( ) you need options (embedded_titles='Yes')

3. define Date_TimeStamp1/"Date TimeStamp1" style(header)=[background=lightgreen] width =16  display;

--
Paige Miller
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

1) put(input(full_date_time_var,e8601dt.),date9.)

2) Excel does not show headers/footers by default - this is an Excel problem.  If you go into print preview mode you will see them.  If you want a subheading in the data use compute block:

compute before;

     line "a line to place in front of output";

endcomp;

** Edit: Good point PaigeMiller, forgot about the embed option.

3) You do not want to rename a variable name, you want to alter the label associated with the variable:

define data_timestamp1 / label="Date Timestamp1";

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 2 replies
  • 1534 views
  • 6 likes
  • 3 in conversation