As a SAS programmer evolves, they start to think:
"Hey, I can create SAS code using data step or macros!"
So they start to go down the happy path of code generation:
data _null_;
file "myplace";
put "data test ;
/ " set a; "
/ " x = wereHavingFunFunc(y)" ;
... etc.
run;
...and pretty soon they have elaborate SAS code in macros, etc. that does nothing but generate code. If you don't use my utility SasEncase to help you do this, you are doing a LOT of extra work but that is another story.
Well, I think the next level of thought (at least for me) was:
"Hey! Why can't I just use ANY programming language to generate SAS code"
Now, think about that for a sec. ANY programming language can be used to generate SAS code.
The reason why SAS is an entry into this area is because that is what all of us know and love. But, don't confine yourself to just using SAS for code generation. Instead, pick other languages as the need arises.
public void CreateSomeSasCode()
{
StreamWriter sw = new StreamWriter(@"c:\temp\mySasCode.sas") ;
sw.WriteLine("data test;") ;
....
}
Now, that's better, a little C# to play with.
Ok, so you would have to wrap a lot of code.
I think I have evolved. Now I actually write the SAS code with macro parms and store them on a server. Then you can just call the stored process and pass the parameters using web services:
DataSet ds = SasServer.Services.ExecuteStoredProcedure("mySasCode.sas", @"%let outdata = 'c:\temp'");
Now, I think we have nirvana: SAS doing what it does best being driven by a modern OOP environment.
Dropping flyballs in left field,
Alan
This blog is designed to show various ways to use Data Virtualization, technologies, and SAS with Microsoft technologies with an eye toward outside of the box thinking.
Subscribe to:
Post Comments (Atom)
SAS throwing RPC error
If you are doing code in C# and get this error when creating a LanguageService: The RPC server is unavailable. (Exception from HRESULT:...
-
I was just tasked to read in LDAP records so we could cross-reference userids with login identifiers and general ledger information. Using...
-
I am finally ready with my SAS dataset reader/writer for .NET. It is written in 100% managed code using .NET 3.5. The dlls can be found here...
-
Well, around 14 months ago, I started on a journey to understand the SAS dataset so I could read and write one independently. Originally, I ...
2 comments:
As a SAS programmer evolves, they start to think:
"Hey, I can create SAS code using data step or macros!"
And it usually ends in tears
Good post.
Post a Comment