Subscribe to DSC Newsletter

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

Views: 1939

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
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

RSS

On Data Science Central

© 2019   AnalyticBridge.com is a subsidiary and dedicated channel of Data Science Central LLC   Powered by

Badges  |  Report an Issue  |  Privacy Policy  |  Terms of Service