BookmarkSubscribeRSS Feed
alberto_dli
Calcite | Level 5

Hello,

I am trying to generate a html file with a variable value. I am trying it with proc print and ods:

%let fecha=20141013;

data disponibilidad;
   fecha=&fecha;
run;

ods html file='C:\example.htm' ;
proc print data=disponibilidad label;
run;
ods html close;

The problem es that the html ganerated has column headers and one column with the obs number. is it possible to dissable them? i just need the value ot the variable.

Thank you

7 REPLIES 7
user24feb
Barite | Level 11

You can suppress the number of observations with "NoObs", but I think you need to switch to proc report to remove the variable name:

Proc Report Data=disponibilidad Nowd;

  Define fecha/display ' ';

Run;

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, observations is easy to get rid of, just add option nooobs:

proc print data=xyz noobs;

For the second part the column headers.  This is a fundamental part of SAS.  It deals with tables which have headers.  You can try assigning a missing to the label =

data disponibilidad;

   fecha=&fecha;

     label fecha " ";

run;

Might help.  Or put your test into a title/footnote statement.  If you provide example of what you want out we could suggest.

alberto_dli
Calcite | Level 5

Thank you very much,

i tryied with this:

%let fecha=20141013;

data disponibilidad;
  fecha=&fecha;
   label fecha " ";
run;

ods html file='C:\Users\adelaigm\Desktop\A.htm' ;
proc print data=disponibilidad noobs label;
run;
ods html close;

obs column problem solved, but the header "fecha" is still appearing. Any other suggestion?

may be is possible to resize the html in order to hidde the area i dont want to display...

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Maybe if you can provide an example of the output.  As user24feb mentioned, try out proc report.  You can hide borders then as well (or color them the same as background.

However if you want text outside the table structure, then you are better off putting it in a title statement.

alberto_dli
Calcite | Level 5

Thank you so much,

I finally did it with a proc report. As long as i dont need any format at all, i export the file as a csv instead of html, but ithe rename the file to .html, so i could get a plane hmtl with the variable value.

title;

ods csv file='C:\Users\adelaigm\Desktop\report2.html' ;

Proc Report Data=disponibilidad Nowd;

  Define fecha/display ' ';

Run;

ods csv close;

ballardw
Super User

A data _null_ might work;

Instead of proc print:

data _null_;

     set disponibilidat;

     file print;

     put fecha;

run;

This is very old school, but will generate output with no column headers. For multiple variables you will likely want to look up the options that control column position start locations and formats.

Reeza
Super User

Use ODS HTML TEXT =

%let fecha=20141013;

title;

ods noptitle;

ods html file='C:\temp\sample.html';

ods html text="&fecha";

ods html close;

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 7 replies
  • 1092 views
  • 6 likes
  • 5 in conversation