BookmarkSubscribeRSS Feed
RustyOwens
Fluorite | Level 6

OK, So I had an issue the other day getting SAS to generate HTML code. After a lot of trial and error, I got that working.  Now as I loop through my list of companies, I need to be able to pass a link to edit them. The sas file is in the same directory as my other code so it should be straight forward to link to it but I keep getting file not found.  My latest attempt looks like this:

 

put "<td><a href=""/sas/config/Lev1/SASApp/SASEnvironment/SASCode/csg/Edit_Company.sas?id=" ID """>Edit</a></td>";

 

That is actual path to the file on the server but this is part of the storedProcess so does that cahnge how this link should look?

3 REPLIES 3
Quentin
Super User

I'm confused. 

 

Is your SAS code running as a stored process on a SAS 9 BI server or some other similar environment?

 

It looks like you are creating a link that points to a .sas file. Why would that be useful?  Do you want the user to be able to display sas code in a browser window? Or do you want that SAS code to be executed when they click the link?

 

In a stored process setting, you can use SAS to return an HTML page which has links to other stored processes that run more SAS code.  So "chaining" stored processes.  But that link would point to a stored process stored on the metadata server, not a .sas file.  On my server, the links look like:

 

https://servername.com/SASStoredProcess/do?&_program=/MetadataPath/StoredProcessName

Big picture, yes, you can use ODS HTML or similar to generate an HTML file with links pointing wherever you want.  If you're having problem with the link you're generating, I would start by checking your generated HTML file to see where the actual link is pointing.  And then play with that URL in your browser to see if you can figure out a URL that works. But I don't think it will be a URL that points to a .sas file.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.
RustyOwens
Fluorite | Level 6

So the reason I will state here but TLDR I have been given a SAS solution to use as a solution for a customer grouping problem. The other solution uses a bunch of if statements to do the clean up. My idea was essentially to have a mapping table to use to update the main table. But I want to give the users the ability to add records to this table so the developers don't haver to change the code each time they find another exception. I have tried a half dozen attempts.  I have a table which displays all the records find if I go to it directly (SASStoredProcess/do?_action=form,properties,execute,nobanner,newwindow&_program=%2FStored_Processes%2Fcsg%2FManage_Companies.sas) 

 

The full explanation  is here if you want to see where I am coming from.

Re: Can you write html code with SAS - SAS Support Communities

Quentin
Super User

Yes, I saw your earlier post, and suggested Data Controller so you don't have to hand-code this.  But I'll admit for little stuff I've hand-coded a few stored processes to allow users to maintain a simple table with a list of items.

 

It sounds like at this point you have a stored process (?) Manage_Companies that works if you use your browser to go to:

 

https://servername.com/SASStoredProcess/do?_action=form,properties,execute,nobanner,newwindow&_program=%2FStored_Processes%2Fcsg%2FManage_Companies.sas

And I think you're creating a new stored process Edit_Company.  Is that stored process working?  Do you have a URL you can go to manually that works, something like:

https://servername.com/SASStoredProcess/do?_action=execute,nobanner,newwindow&_program=%2FStored_Processes%2Fcsg%2Edit_Company.sas?ID=3

?

First I would get it to the point where you have working URLs for both ManageCompany and EditCompany. For the EditCompany you can hardcode the value for the ID parameter.

 

Then the next step is to work on having SAS generate a link with a URL to EditCompany.  So you could have a PROC REPORT step or whatever, that has rows for each company, and a column with a link that displays as "Edit" which when clicked will run the EditCompany stored process, passing it the appropriate ID.

 

But before trying to get SAS to generate the URL to run EditCompany, you need to know the exact URL you want to generate.

 

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 728 views
  • 2 likes
  • 2 in conversation