BookmarkSubscribeRSS Feed
Reddi
Fluorite | Level 6

Hi ,

 

I'm trying the below program and need to show titles and footer in the exported excel file , may be like run date and some comments.

 

ods tagsets.csv file="%SYSFUNC(PATHNAME(WORK))/Motor_Daimler_&sysdate..csv" RS=NONE options(PREPEND_EQUALS="yes" QUOTE_BY_TYPE="yes" );

proc print data = Final_SUMMARY_12MTD label noobs;

run;

ods _all_ close;

 

Can someone amend the above program.

 

Thanks in advanceeee

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

CSV = Comma Separated Variable file - which is a more or less standard file format which has row 1 as column headings, and then the data on the following lines separated by commas.  It does not support titles/footnotes or anything else.  

 

What I assume your doing is wanting to open the data in Excel and see some Excel specific parts like titles/footnotes.  If so then switch over to tagsets.excelxp and embed the titles - note that this is an output review file, not great for data transfer - but then CSV is ideal for data transfer and not good for output review so choose what the purpose is.

 

ods tagsets.excelxp file="...\abc.xml" options(embed_titles='yes');
proc print...;
run;
ods tagsets.excelxp close;
Reddi
Fluorite | Level 6

Hi @RW9,

 

cant we export it as a excel file ? also can you amend the program below including Title and footnote statement. I tried it with .xml format itself but no use.

 

Thanks

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Tagsets.excelxp generates XML file which Excel can read just fine (you may need to assign XML as Open With Excel - you could call the file xlsx to get this automatically, but its not advised as its not really an Excel file).  This tagset has all the necesary parts to make the output look nice - i.e. for review.  As above, you haven't stated what the file is to be used for, either a report for review, or data transfer.  

ods tagsets.excelxp file="...\abc.xml" options(embed_titles='yes');
title "Hello World"; proc print...; run; ods tagsets.excelxp close;

 If you want CSV, then no titles.  If you want pure XLSX file, then you can use libname excel, however again, you wont get titles/footnotes.

Reddi
Fluorite | Level 6

Hi @RW9,

 

still i'm not able to get the required.

 

My coding is below.

 

 

ods tagsets.excelxp file="%SYSFUNC(PATHNAME(WORK))/Motor_Daimler_&sysdate..xml" RS=NONE style=Journal

options(PREPEND_EQUALS="yes" QUOTE_BY_TYPE="yes") options(embed_titles='yes');

title "Sample1";

proc print data = Final_SUMMARY_12MTD label noobs;

run;

ods tagsets.excelxp close;

filename outbox email;

 

 

If you can please amend the program.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

This should work, though I can't check at the moment:

ods tagsets.excelxp file="%sysfunc(pathname(work))/motor_daimler_&sysdate..xml" style=journal
  options(embed_titles='yes');

title "sample1";
proc print data = final_summary_12mtd label noobs;
run;

ods tagsets.excelxp close;

Oh, its probably not a good idea to write the file to work as that is a temporary area.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 1068 views
  • 0 likes
  • 2 in conversation