BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,
I am trying to build an application which would use ASP.NET for the interface.
I have SAS EG installed on my system. I have completed a stored process which i want to run through this application when the interface is used.
The information entered on the interface will be used as the stored process parameters.

Any help would be appreciated.

Thanks,
Saurabh.
5 REPLIES 5
Cynthia_sas
SAS Super FREQ
Hi:
If you go to support.sas.com and look for the SEARCH box in the upper right hand corner of the web page (above the dark blue banner), you can type a search string into the SEARCH box. If you type
stored process ASP
into the search box and then click the Search button, you will find that at least 8 of the first 10 hits that are returned are relevant to your question.

cynthia
deleted_user
Not applicable
Ok,
After a long time I have been successful running a independent SAS code file from a Web Application written in C# ASP.NET. I wanted to get some more pointers on the same.
Do help me with it.

using a part of the code which is as follows:
SAS.StoredProcessService sp =sasWS.LanguageService.StoredProcessService;
// tell it where to find the stored processes
sp.Repository = "file:c:\\output\\procs";
// and execute the stored process
sp.Execute("check","strPath=Hello");
where sasWS is SAS workspace object.

check is stored process name.
The information I want is how to send the parameter strPath to the SAS code. The line :
sp.Execute("check","strPath=Hello"); has the parameter argument but it does not get populated as variable in SAS code which I call.
SAS code is as follows:

%let strPath=;
proc print data=test;
title="&strPath";
run;
where test is a temporary dataset. The stored process runs successfully which I see in a HTML output of the proc print. But the title doesn't get populated in the title.

Please help me to get this done.


Thanks,
Saurabh.
Cynthia_sas
SAS Super FREQ
Hi:
This may be a question for Tech Support.

If your parameter is being passed successfully, it would come to your program as a SAS macro variable. I'm not sure why you have this:
[pre]
%let strPath=;
[/pre]

...in your program, as it would serve to BLANK out or turn your macro variable to NULL. You might try removing that statement in the stored process and see what happens.

cynthia
deleted_user
Not applicable
Hi,
Well thank you Cynthia. I really don't know why, I put that statement in my code. That would work if it were a parameter in a macro.
Removing it, the stored process worked.

Though I would like to know the importance of *Process Body. It gives a warning when I do not write that statement, but the code runs successfully.

Also I tried using %stpbegin & %stpend for the stored process.
But it doesn't work. It gives the error on these lines though runs the inside code successfully.

Thanks,
Saurabh.
Cynthia_sas
SAS Super FREQ
Hi:
*ProcessBody; is a comment that is used for a specific purpose regarding the initialization of macro variables and when macro variables are made available to the stored process. It has to do with the difference between the Workspace Server and the Stored Process Server, as described here:
http://support.sas.com/kb/14/861.html
http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/input.html
http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/stpmacro.html

As a best practice, in class, we recommend that you ALWAYS use the *ProcessBody; comment because then you have the most flexible stored process that could run on either server without any editing of the SP code, as described here from the doc:
"Parameters are not initialized in the same way for the stored process server and the workspace server. The stored process server sets parameter values before the stored process begins to execute. This means the first line of code in the stored process can access any input parameter macro variable. The workspace server does not set input parameters into macro variables until it reaches a *ProcessBody; comment line in the stored process:

*ProcessBody;
A stored process that does not contain this line will never receive input parameters when executed on a workspace server.

It is recommended that you begin all stored processes (regardless of the server types) with %GLOBAL declarations for all of your input parameters followed by the *ProcessBody; comment:"


I also included the link for %stpbegin; and %stpend; (note that those are actually very LONG macro programs and to use them correctly, they MUST have ending semi-colons to correctly terminate the invocation string. Any overrides to the reserved macro paramters MUST appear BEFORE the %stpbegin; invocation.

Some examples of stored processes and how to convert existing programs and macros to stored processes are contained in these papers (however, none of these papers discuss using ASP or .NET -- they just focus on changing the SAS code & reasons & techniques):
http://www2.sas.com/proceedings/forum2007/021-2007.pdf
http://www2.sas.com/proceedings/forum2008/024-2008.pdf
http://support.sas.com/rnd/papers/regional07/paradigm_edu07.zip
http://support.sas.com/rnd/papers/regional08/SP_Template.pdf

You could have been getting an error because of the absence of the *ProcessBody. Without seeing the log message or your entire SP code, I don't know why you're getting errors. You might want to work with Tech Support, if the errors persist after you use *ProcessBody.

cynthia

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