Hi Milton,
Not sure if you have gotten this to work but wanted to chime in that I have built several examples using JavaScript within SAS Stored Processes.
Recent examples are a custom html form (built within the stp) that includes javascript functions to clear out special characters before submitting the process, another is a custom drop down box on the left side of a proc gchart.
Run it on the stored process server and be sure to leave the %STPBEGIN/%STPEND macros turned off.
~ Angela Hall
Hi Angela,
Thanks! Will check on your blog. I might get some more creative stuffs out there.
I'm currently implementing and testing stp + jquery right now. I have 6 portlets, the values of the different fields on the 1st portlet controls all the results of the other 5 portlets. The submit button on the 1st portlet calls an ajax request which prepares the data for the other portlets before the content portion of the current page gets refreshed.
So far I'm getting what I am expecting. It's cool that sas could work in combination of html. Coding is just a little messy because of the put statements. :smileylaugh:
Milton
Ah the put statements. I would actually recommend moving toward the cards4; input data lines capability.
Here is a great example - this avoids the quoting around java/js/etc and put statements.
http://support.sas.com/kb/37/050.html
Good luck!
~ Angela
WOW! I didn't know this! This surely will make the code more readable and neat!
Thanks again Angela for this great info.
Milton
Sounds very interesting, I would love to see the result and howto?
Hi,
Will try to show the result after implementing this one.
Hi there, i started with something basic. I was trying to get an autocomplete textbox but it does not work.
This is my code, when running the html as test.html it works...
data _null_;
format infile $char1000.;
input;
infile = resolve(_infile_);
file _webout;
put infile;
cards4;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" href="http://dev.jquery.com/view/trunk/plugins/autocomplete/demo/main.css" type="text/css" />
<link rel="stylesheet" href="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.css" type="text/css" />
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.bgiframe.min.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.dimensions.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js"></script>
<script>
$(document).ready(function(){
var data = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities".split(" ");
$("#example").autocomplete(data);
});
</script>
<title> Test </title
</head>
<body>
API Reference: <input id="example" /> (try "C" or "E")
</body>
</html>
thanks!!!!
;;;;
run;
Hi,
I actually tried your code above and got the same result.
So instead of referencing the js file on their site like this...
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js"></script>
Try downloading the js and css files and put it somewhere your server so you can access it like this...
<script type="text/javascript" src="http://sasserver:8080/Portal/scripts/jquery.autocomplete.js"></script>
or even create a different war file to place your jquery files
<script type="text/javascript" src="http://sasserver:8080/MyCustom/scripts/jquery.autocomplete.js"></script>
Hope this helps.
Milton
Milts
Thanks but i dont have any idea how i can put files on my sasserver like that? Is it via management console?
Im really waiting for your examples with Jquery
greets
Hi Filip
Sorry for the late reply.
If you are using Tomcat here's an example of steps you can do:
1. on your tomcat webapps directory (ex. C:\<tomcat version>\webapps), copy SASTheme_default(since it's the simplest out there) and rename it whichever name you like (ex. SASCustom)
2. Delete the contents of SASCustom except for the META-INF and WEB-INF folders.
3. Add new folders on SASCustom (ex. scripts, styles).
4. Add files that you'll want to be accessed by your stored procs (ex. put your jquery scripts inside SASCustom\scripts-)
5. Restart Tomcat
6. Open a browser and try to check if you can access http://<servername>:8080/SASCustom/scripts/jquery.js. If it prompts you to open or download the file, then you've correctly done the steps above.
7. Try your jquery explorations. Actually I only used jquery to simplify access(instead of using getelementbyid most of the time because it's so looooong) and for the ajax function(i'm not confident using ajax if I'll be coding the function myself haha!). What you're trying to actually explore like your testing above is more advanced. Enjoy!
However, if you're using Weblogic or WebSphere, there are a few more steps and I'm not much familiar about it but it's still similar to the example I gave above.
Hope this helps.
Milton
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.