BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Eva
Quartz | Level 8 Eva
Quartz | Level 8

Dear all,

I'd like to do several drill downs from my stacked bar graph which I show in the SAS portal within a STP: Click on subgroup, click on value of maxis. What then should happen is that I send parameters to the next STP which is a proc report with a data step before it. In ths is data step I would then take the values of the parameters and put them into a where statement. The part about the data step and the proc report is clear to me. What I don't know how to do it is the drill down.

First I need to drill on one segment of a subgroup in a bar. I then would like to send via STP parameters the value of the bar and the subgroup to the next STP.

The same with the Click on the value of the maxis: I'd like to send STP parameters to the next STP containing the value of the selected value on the maxis.

I have STP parameters already. Let's call them var_subgroup, var_bar, var_maxis.

Is that possible?

Regards

Eva

1 ACCEPTED SOLUTION

Accepted Solutions
GraphGuy
Meteorite | Level 14

Similar to putting the html href= and title= tags in the variable, you can also use the html target= tag to control whether the url is displayed in a separate/named window, or in the same window (target="_self").  Here's a random/Google page with some info on the html target tag:

HTML _self - HTML Code Tutorial

Something like this (of course, you'll have your programmatically built stored process webapp url rather than the hard-coded url I used here)...

data foo; set sashelp.class;

length my_html $500;

my_html=

'title='||quote(name)||

' target='||quote('_self')||

' href='||quote('http://www.sas.com');

run;

proc gplot data=foo;

plot height*weight / html=my_html;

run;

View solution in original post

10 REPLIES 10
GraphGuy
Meteorite | Level 14

I assume you already have your stored processes running?

Do you know the URL (I think it's called Stored Process WebApp URL?) that you can use to run the stored process directly in  a browser, and pass parameters as part of the URL?

Assuming you've got that ready...

Then if you're using Proc Gchart to generate the bar charts, you can use the 'html=' option to specify a variable that contains the urls (with html href drilldown strings) for each subgroup (segment) of the bar chart to drill down to (you will probably want to create these programmatically from the data).

To get drilldown urls associated with the maxis values (ie, the bar labels), you'll need to suppress the default max values, and annotate them ... you can then use the 'html' variable in the annotate data set similarly to the variable you used with gchart's html= option.  In the case of annotate data sets, the variable *must* be named 'html'.

Here are some examples that show (in general) how to set up the variables in your data set to have urls/links.  (You'll need to figure out what the URL for your stored process server needs to be, and then adapt the code to use those URLs)

http://robslink.com/SAS/democd23/aaaindex.htm

(This advice is somewhat general - as you work your way through this, feel free to post up some more specific questions!)

Eva
Quartz | Level 8 Eva
Quartz | Level 8

Dear Robert,

I worked with what you suggested. Yes, I have an STP running which displays my graph. And it is also able to display a table depending on the parameters I send to the STP.

I used the html Option on a simple gchart (not stacked):

options noquotelenmax; /* to erase the warning when the drill string gets too long */

data work.mydata;

     set report.mybigdata;

     length drill_url $400.;

     where .....;

     drill_url = cats('/SASStoredProcess/do?_program=%2FStored+Processes%2FprojectA%2Fmy_stp&year=',year,'&country=',country);

run;

proc gchart data=mydata;

     vbar year / sumvar=mysum

                     group=country

                     discrete

                     html=drill_url;

run;

quit;

When I click on a bar a new window openes and correctly displays what I want to see. The parameters are sent and used by the target STP.

Is it possible to have the drill down open in the same window instead of in a pop-up window?

And secondly: can I use the same code with subgroup in the proc gchart and be able to click on one segment of the bar?

Best wishes

Eva

Eva
Quartz | Level 8 Eva
Quartz | Level 8

Hi there!

I tried it with the subgrouped vbar and it works!

options noquotelenmax;

data work.mydata;

     set report.mybigdata;

     length drill_url $400.;

     where ....;

     drill_url = cats('/SASStoredProcess/do?_program=%2FStored+Processes%2FprojectA%2Fmy_stp&year=',year,'&country=',country,'&carmodel=',carmodel);

run;

proc gchart data=work.mydata;

     vbar year / sumvar = mysum

                     group = country

                     subgroup = carmodel

                     discrete

                     html = drill_url;

run;

quit;

Remains the question how to open the target STP in the same window.

And another question: I need to have a drilldown by clicking on the group name on the x-axis. E.g. the group variable in country and I have Germany and USA on the x-axis. I'd like to be able to click on the word "Germany" and thus make a drill down. Is that possible? and how?

Best wishes

Eva

GraphGuy
Meteorite | Level 14

Similar to putting the html href= and title= tags in the variable, you can also use the html target= tag to control whether the url is displayed in a separate/named window, or in the same window (target="_self").  Here's a random/Google page with some info on the html target tag:

HTML _self - HTML Code Tutorial

Something like this (of course, you'll have your programmatically built stored process webapp url rather than the hard-coded url I used here)...

data foo; set sashelp.class;

length my_html $500;

my_html=

'title='||quote(name)||

' target='||quote('_self')||

' href='||quote('http://www.sas.com');

run;

proc gplot data=foo;

plot height*weight / html=my_html;

run;

Eva
Quartz | Level 8 Eva
Quartz | Level 8

I tried it and the variable my_html looks in an example like this:

target="_self" href="/SASStoredProcess/do?_program=%2FStored+Processes%2FprojectA%2Fmy_stp&year=2012"

Unfortunately a new window opens at drill down. I use goptions device=activex. Is that a problem?

GraphGuy
Meteorite | Level 14

I'm not sure about activex - it does things "differently".

I always use (and recommend) device=png.

Eva
Quartz | Level 8 Eva
Quartz | Level 8

I tried your code above with activex and the drill down opens a new window 😞

I don't understand why different devices don't offer all functionality

Why I didn't switch to png is because I always get the following error message with device=png:

ERROR: Insufficient authorization to access /saspath/on/unix/server/gplot.png

I use the following code:

ods _all_ close;

ods html file=_WEBOUT(no_top_matter no_bottom_matter) encoding="utf-8";

goptions reset=all device=png;

<your code from above with the target=_self >

ods _all_ close;

GraphGuy
Meteorite | Level 14

It's probably best to open a track with Tech Support to try to figure out why you're getting the "insufficient authorization" with device=png stored processes.  I'm not familiar with trouble-shooting stored processes enough to be able to help on that one, but I'm sure Tech Support has some experts in that area.

Eva
Quartz | Level 8 Eva
Quartz | Level 8

Dear Robert,

my STP is "Streaming". I tried "Package" instead and then I get the error

ERROR: insufficient access to .../_webout

Could this be a problem? Do I need streaming or package für png?

Best wishes

Eva


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