AnalyticBridge

Social Network For Analytic Professionals

I need to do heavy parsing / text processing / text mining, and I was wondering how you can call a Perl script from within SAS.

Thanks,
Vincent

Share

Reply to This

Replies to This Discussion

Subject: RE: How to run a Perl script from within SAS
From: "Terjeson, Mark"
To: "Vincent Granville"


Hi Vincent,


If you want to run a script and you
are not returning anything you can
use the X statement or the CALL SYSTEM().
If you are returning goodies then you
can use the FILENAME PIPE capability.




Hope this is helpful.



Mark Terjeson
Investment Business Intelligence
Investment Management & Research
Russell Investments

Reply to This

Subject: RE: How to run a Perl script from within SAS
From:
To:


I'm going to reply to the list because it's where it's posted, but you
can make it cross-posted at the other site...


There are 2 ways to do this, depending on whether or not you want to
parse the STDOUT of the Perl script's output...


1. To just execute the script, just use the 'X' command, like so:


X "c:\path\to\perl\script.pl";


Or, if you need to:


X "perl c:\path\to\perl\script.pl";


2. To run a Perl script and capture the script output in, say, a data
step to parse, you need the 'filename pipe' construct:


Filename myfh pipe " c:\path\to\perl\script.pl" lrecl=32767;


You can now read the 'myfh' filename just like you would a regular flat
file, and parse it as you se fit:


Data work:
Infile myfh;
Input ...;
Run;



HTH,
Matt

Reply to This

RSS

Featured


Advertisement

© 2010   Created by Vincent Granville

Badges  |  Report an Issue  |  Privacy  |  Terms of Service