BookmarkSubscribeRSS Feed
metalray
Calcite | Level 5
Hi Guys,

we have an internal website that we want to link to in our web reports but
the requirement is to add a SAS web report or browser language of the user to that link.
right now the STP is very simple and I wonder if there is a variable (global, session?)
that would tell us which language the user is using to look at sas web report studio or
finaly info delivery portal.

data _null_;
file _webout;
put '';
put 'Link to language specific product details';
put '';
run;


Thanks
Bob
14 REPLIES 14
AngelaHall
SAS Employee
Bob,
You will need to include some javascript in your stored process to retrieve the browser language. A quick search via google found this:

var userLang = (navigator.language) ? navigator.language : navigator.userLanguage;
alert ("The language is: " + userLang);

(retrieved from: http://answers.yahoo.com/question/index?qid=20080418104516AAssAjm)

~ Angela
metalray
Calcite | Level 5
Hello Angela,

Thanks for the hint. I did not think about Java script.
The following works now in EG 4.2 if I click on the stored
process to modify it and in the "SAS Code" section undo the "Include Code for"..."Stored Process macros".

If I leave it it the following error comes:
"ERROR: File is in use, _WEBOUT "

In the web report studio the same code gives me the error
"The specified stored process does not produce package results. Only stored processes producing package results can be processed."!

The execution is set to streaming and if I change it to package a new error comes:
ERROR: Insufficient authorization to access /project/sas92config/dev/config/Lev1/SASApp/_webout.dat.

I am sorry for the bad display of the following code but the forum software has some difficulties with it.
metalray
Calcite | Level 5
data _null_;
file _webout;
put ' ';
put ' ';
put ' ';
put ' ';
put ' ';
put 'myLink ';
put ' ';
put ' ';

run;
AngelaHall
SAS Employee
The %stpbegin and %stpend macros can lock the webout location from further updates. Here is my blog post on how to write code out to the stored process streaming location.

http://sas-bi.blogspot.com/2010/07/combining-graphsprocs-with-custom-html.html

Also - here is a sample from SAS on putting out HTML code without worrying about all the ' and " values:
http://support.sas.com/kb/37/050.html

~ Angela
metalray
Calcite | Level 5
Hello Angela,

Thanks for your input.
while waiting for a reply I changed the execution to the workspace server and the output to package
to follow the fix mentioned here http://support.sas.com/kb/33/846.html in EG 4.2 the STP
executed without problems but in WRS it still showed : "The specified stored process does not produce package results. Only stored processes producing package results can be processed."!

I changed it back to the stored process server with streaming output and used your example,
pasting in my own code. The STP runs but there is an empty result html . Using stpbegin or not does not change it and
opening it in WRS still tells me that there is no package result (leading me to http://support.sas.com/kb/33/846.html again).

Now, using the other example you posted, it actually gives a result in EG 4.2 but saving it again as a STP
and placing it in my web report gives the error ""The specified stored process does not produce package results. Only stored processes producing package results can be processed."!",
leading me again to http://support.sas.com/kb/33/846.html.
If I select packaging as execution option I am at error "ERROR: Insufficient authorization to access /project/sas92config/dev/config/Lev1/SASApp/_webout.dat." then http://support.sas.com/kb/17/316.html tells me I should set it to "streaming".

It seems I am running around in circles.


ods html body=_webout (no_bottom_matter) path=&_tmpcat (url=&_replay);

/* This is where SAS Procs can go to produce output to the website*/

data _null_;
put ' ';
put ' ';
put ' ';
put ' ';
put ' ';
put 'myLink ';
put ' ';
put ' ';
run;

/*Close the _webout location to allow the data _null_ step to write to it*/
ods html close;

/*This is where Data Null HTML Code can go*/
data _null_;
file _webout;
put '';
put '';
/** INSERT OTHER HTML CODE HERE **/
run;

/*Reopen the _webout location for SAS Procs to write to.*/ods html body=_webout (no_top_matter) path=&_tmpcat (url=&_replay);

/* This is where SAS Procs can go to produce output to the website*/

proc gchart data=sashelp.shoes;
vbar region/sumvar=sales;
quit;

/*Closes the web output location.*/
ods html close;



Bob

PS: Dear Forum Admin, I just noticed that the html code in this post actually generated a link. I dont think its great that this happens when posting code examples
AngelaHall
SAS Employee
Bob,
Do you have the STP registered to a workspace server? To have the stored process generate streaming results, it needs to be registered to the stored process server.

Also - I would move the line:
file _webout;

To be immediately below the first data _null_ statement.

~ Angela
metalray
Calcite | Level 5
Hi Angela.

I dont even now if I should use streaming or package result. it always tells me in WRS
"The specified stored process does not produce package results. Only stored processes producing package results can be processed."!",
That reads like it should be a package result.

What do you mean by "registered" I selected the stored process server as execution server is that not enough?

I use the code from one of the examples you sent, it shows fine in EG 4.2 but not in WRS (see "The specified stored...).
metalray
Calcite | Level 5
data _null_;
format infile $char256.;
input;
infile = resolve(_infile_);
file _webout;
put infile;
cards4;





myLink


;;;;
run;
metalray
Calcite | Level 5
Hello Angela,
I looked at your examples again but struggle to get any STP displayed on my web report.
The error is the following:

"The specified stored process does not produce package results.
Only stored processes producing package results can be processed."!

I have the Logical Stored Process server and streaming output selected and wonder if
it has to do with this:

SAS Web Report Studio does not support "Streaming" output.
So, your stored process cannot write to the "_webout"
fileref.

http://support.sas.com/kb/19/597.html
metalray
Calcite | Level 5
It seems that web report studio can not deal with _webout. Which is a big problem when one wants to generate dynamic html.
Cynthia_sas
SAS Super FREQ
In my experience, folks who are using custom HTML either use the SAS Information Delivery Portal or the SAS Stored Process Web Application or they integrate the calls to run Stored Processes into their own web sites ...using JSPs or URL calls to the Stored Process Web Application.

While SAS Web Report Studio runs -inside- a browser, it is a reporting -application-, built on Java technology, not built on HTML technology. The SAS Web Report Studio maintains state and does not work using the HTTP protocol.

The HTTP protocol primarily uses a request/response model in which a client browser makes a URL-request and the receiving server satisfies the request and sends HTML results (usually) back to the client browser. Once this transaction is finished, the server is out of the picture and a new request from the client is a new request.

When you log onto SAS Web Report studio, the browser is merely a container to hold and display the WRS application screens. The servers that you use and the requests that you make and the reports that you build are all handled within your logon session to WRS.

Generally speaking the _WEBOUT file reference is used with HTTP-based or HTML-based client applications like the Portal and the Stored Process Web Application, or with custom front ends, such as you might code yourself using .NET or Java technology.

Depending on what you want/need to do, it might not be appropriate to use _WEBOUT with Web Report Studio reports. You might want to check with SAS Technical Support or, look at some of the SPWA sample programs -- there are many examples of drilling down and creating linked output and using _WEBOUT with the SPWA.

cynthia
metalray
Calcite | Level 5
Hi Cynthia,
Thanks for the detailed reply.
Below is the most recent version of the code. It is displayed without errors but
the HTML is not rendered as HTML either, the code is displayed:



*ProcessBody;
%STPBEGIN;

%let libWORK=%sysfunc(pathname(WORK)); * work lib is on UNIX ;
ods html body="&libWORK./MYFILE.htm" ;
data _null_;
file print;
put '' /
' '/
' A Title '/
' some content ';
run;
ods html close;

data _null_;
file "&libWORK./MYFILE.htm";
run;

%STPEND;

If the code is rendered as HTML I would need to extend it with java script to fetch the browser language and build a link.

I am avoiding the webout problem by writing into the WORK library of the specific user so they dont overwrite
each others html output (and html output cant be avoided since _webout is not applicable)


SPWA Problems: The STP is executed somewhere else, I wont get the URL of the report (report name), another login is required
SAS Delivery Portal Problem: The link is web report based/dependant, so it has to be put on each report using WRS

Regards,
Bob
Cynthia_sas
SAS Super FREQ
Hi,
I really think that you should work with Tech Support on this. Just seeing your code is not even 1/4th of the necessary information. You need to supply stored process execution options, server used,parameters, client info, URL that is used to execute the SP, screen shots of what you see would be useful (for example, I don't know what you mean by "the code is displayed".)

Tech support can open a track, clarify this info and work with you to a resolution.

Cynthia
metalray
Calcite | Level 5
Hello Cynthia,

Thanks for your input. I have been through this topic with Tech Support but there was no solution apart from refering me to use Stored Process Web Applications (which does not help).

Let me try to give you the missing 3/4 of the information:
STP Execution Server: Logical Stored Process Server, also tried with Workspace Server
STP Execution Options: Package, since WRS can not deal with Streaming output (http://support.sas.com/kb/19/597.html )
URL used to execute STP: None it should be placed within a web report, just like we can do it with other STPs
Screen shot: As far as I know the SAS forum software does not allow screen prints to be added

When I say "The code is displayed". I mean that the code not rendered as HTML but as Text and is displayed as text.

STP (inserted into Web Report) Code:
---------------------------------------
*ProcessBody;
%STPBEGIN;

%let libWORK=%sysfunc(pathname(WORK)); * work lib is on UNIX ;
ods html body="&libWORK./MYFILE.htm" ;
data _null_;
file print;
put ''/
''/
''/
' '/
''/
'myLink '/
' '/
' ';

run;
ods html close;

data _null_;
file "&libWORK./MYFILE.htm";
run;

%STPEND;

---------------------------------------
I hope that helps.
I noticed that WRS wraps the code in a
 tag, which explains which my HTML/JS is not properly renderd.

<html>                                         
<head>
<title> A Title </title>
</head> <body> <a href="www.google.com">some content</a> </body> </html>


Regards,
Bob

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
  • 14 replies
  • 2846 views
  • 0 likes
  • 3 in conversation