BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi gyes.

I have two queries, and results are displayed in two HTML Outputs.
StoredProcess shows it in one HTML Output, but I need titles for this tables.
So, how to make titles before tables?

Sorry for my English 🙂
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
Normally, to do what you want, you would use the ODS TEXT= statement, as described in these previous forum postings:
http://support.sas.com/forums/thread.jspa?messageID=6151᠇
http://support.sas.com/forums/thread.jspa?messageID=848͐

The way that ODS TEXT= works needs to change a bit for your stored process. In "regular" SAS, you would do this:
[pre]
ods html file='somefile.html' style=sasweb;
ods html text='before proc 1';
proc print data=sashelp.class;
run;

ods html text='before proc 2';
proc freq data=sashelp.shoes;
tables region;
run;
ods html close;
[/pre]

However, when you turn that program into a stored process, each client application could possibly set %stpbegin for a different destination for returning results. For example, in Microsoft Word, the user could change the result type from a stored process to be: SASReport, HTML or RTF -- you need your ODS TEXT= statement to work for ANY destination the users pick. So, when you convert the above program to be a stored process, you would have to use &_ODSDEST instead of HTML for the TEXT= statement:

[pre]
%stpbegin;

ods &_odsdest text='before proc 1';
proc print data=sashelp.class;
run;

ods &_odsdest text='before proc 2';
proc freq data=sashelp.shoes;
tables region;
run;

%stpend;
[/pre]

Also, keep in mind that some client applications may not make use of the ODS TEXT= string -- so a good idea would be to test your stored process on all client applications from which it might be submitted. In order to add the ODS &_ODSDEST TEXT= statement, you will have to edit the stored process code by selecting OPEN from the SAS Folder list and then editing the code. If you do not have sufficient authorization to edit or change stored process code, then you will have to get an administrator help you make the change.

cynthia

PS -- an afterthought -- have you tried just adding a second title statement before your second proc sql???
[pre]
%stpbegin;
title 'first proc sql';
proc sql;
select *
from sashelp.class
where age gt 15;
quit;

title 'second sql';
proc sql;
select *
from sashelp.shoes
where region = 'Asia' and
subsidiary = 'Bangkok';
quit;
%stpend;

[/pre]
deleted_user
Not applicable
I have done like this, but I had a problem.
Just take a look on this:
Query -> Table, generated by this query(work.table1) -> Code (
ods html file='filename.html';
proc print data=table1;
title 'My Title';
run;
ods html close;

)
But it says that work.table1 not found.
Cynthia_sas
SAS Super FREQ
Hmmm, well your problem doesn't seem to be a title statement anymore. It is hard to diagnose why your work table is not found. This may be a question best answered by Tech Support.

cynthia
deleted_user
Not applicable
I have no idea where the name of the data set TABLE1 comes from, but if you use the GUI to analyse a permanent data set, Enterprise Guide creates a copy of the table in the work library and uses that for analysis.

Then it executes a macro ca;lled _SASTASK_DROPDS to clean up after itself.

If TABLE1 was created by an analysis or descriptive process, then it will have deleted the table copy when the task was complete and you won't be able to print or describe the data.

Kind regards

David

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